繁体   English   中英

将生成的图像保存在IIS虚拟目录上?

[英]Saving generated images on IIS virtual directory?

我需要创建可生成一些图像并返回其路径的Web API。

我使用以下方法创建要保存的路径:

var resultPath = "Images/" + obiektId.ToString() + ".png";
var fullPath = HttpContext.Current.Server.MapPath("/" + resultPath);

并返回resultPath

问题是,我保存站点的虚拟目录是C:\\\\sites\\siteAHttpContext.Current.Server.MapPath("/" + resultPath)返回C:\\\\inetpub\\wwwroot\\Images\\123456.png 然后我无法从10.0.0.106/siteA/Images/123456.png加载图像。

如何将映像保存在基本虚拟目录中,而不是将其保存在wwwroot目录中?

string resultPath = obiektId.ToString() + ".png";
string fullPath  = System.Web.HttpContext.Current.Server.MapPath("~/Images"+ resultPath );

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM