我正在将我的项目从 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>();
以及在配置中
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseServiceStack(new AppHost
{
AppSettings = new NetCoreAppSettings(Configuration)
});
app.UseImageSharp();
但我无法打开图像
http://localhost:3000/blob/media/picture.jpg
在这种情况下,如何启用 ImageSharp.Web 来拦截对 /blob 路由的调用?
是否可以使用 Azure blob 进行缓存,这样就不会在本地存储任何文件?
提前致谢