Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net core ServiceStack Nuxt.js SPA和ImageSharp.Web集成_Asp.net Core_<img Src="//i.stack.imgur.com/WM7S8.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">servicestack_Imagesharp - Fatal编程技术网 servicestack,imagesharp,Asp.net Core,servicestack,Imagesharp" /> servicestack,imagesharp,Asp.net Core,servicestack,Imagesharp" />

Asp.net core ServiceStack Nuxt.js SPA和ImageSharp.Web集成

Asp.net core ServiceStack Nuxt.js SPA和ImageSharp.Web集成,asp.net-core,servicestack,imagesharp,Asp.net Core,servicestack,Imagesharp,我正在将我的项目从Asp.Net MVC迁移到ServiceStack Nuxt.js SPA,我在MVC上使用的一个东西是ImageProcessor.Web来动态操作图像 我现在尝试在ServiceStack Nuxt.js模板上使用ImageSharp.Web和Azure blob 我在ConfigureServices中注册了服务 services.AddImageSharp() .SetRequestParser<QueryCollection

我正在将我的项目从Asp.Net MVC迁移到ServiceStack Nuxt.js SPA,我在MVC上使用的一个东西是ImageProcessor.Web来动态操作图像

我现在尝试在ServiceStack Nuxt.js模板上使用ImageSharp.Web和Azure blob

我在ConfigureServices中注册了服务

  services.AddImageSharp()
                .SetRequestParser<QueryCollectionRequestParser>()
                .Configure<AzureBlobStorageImageProviderOptions>(options =>
                {
                    // The "BlobContainers" collection allows registration of multiple containers.
                    options.BlobContainers.Add(new AzureBlobContainerClientOptions
                    {
                        ConnectionString = "DefaultEndpointsProtocol=https;AccountName=storage1;AccountKey=*****;EndpointSuffix=core.windows.net",
                        ContainerName = "blob"
                    });
                })
                .SetCache<PhysicalFileSystemCache>()
                .SetCacheHash<CacheHash>()
                .AddProvider<AzureBlobStorageImageProvider>()
                .AddProcessor<ResizeWebProcessor>()
                .AddProcessor<FormatWebProcessor>()
                .AddProcessor<BackgroundColorWebProcessor>();
但我无法想象

http://localhost:3000/blob/media/picture.jpg

在这种情况下,如何使ImageSharp.Web能够拦截对/blob路由的调用

另外,是否可以将Azure blob用于缓存,这样就不会在本地存储任何文件

提前感谢

在ServiceStack的模板中,nuxt Webpack开发服务器运行在http://localhost:3000 哪个代理对ASP.NET核心服务器运行的API请求https://localhost:5001.

因此,为了确保您的
/blob
路由是否正常工作,请首先检查是否可以从ASP.NET核心服务器访问它,例如:

https://localhost:5001/blob/media/picture.jpg
  proxy: {
    '/json': {
      target: 'https://localhost:5001/',
      secure: false
    },
    '/auth': {
      target: 'https://localhost:5001/',
      secure: false
    },
    '/metadata': {
      target: 'https://localhost:5001/',
      secure: false
    },
    '/css': {
      target: 'https://localhost:5001/',
      secure: false
    },
    '/blob': {
      target: 'https://localhost:5001/',
      secure: false
    },
  },
如果是,您需要在中注册一个附加的开发人员代理路由,以将所有
/blob/*
请求转发到ASP.NET核心服务器,例如:

https://localhost:5001/blob/media/picture.jpg
  proxy: {
    '/json': {
      target: 'https://localhost:5001/',
      secure: false
    },
    '/auth': {
      target: 'https://localhost:5001/',
      secure: false
    },
    '/metadata': {
      target: 'https://localhost:5001/',
      secure: false
    },
    '/css': {
      target: 'https://localhost:5001/',
      secure: false
    },
    '/blob': {
      target: 'https://localhost:5001/',
      secure: false
    },
  },
如果您的
https://localhost:5001/blob/*
API请求未由ImageSharp提供,那么您需要在ServiceStack之前注册其中间件处理程序以获得更高的首选项,例如:

app.UseImageSharp();

app.UseServiceStack(new AppHost
{
    AppSettings = new NetCoreAppSettings(Configuration)
});

非常感谢你。在过去的两天里,您在这里和GitHub上帮了我很大的忙,我决定为ServiceStack购买一个许可证。再次感谢