我开发了一个模块来保存Windows共享位置的图像 我的代码在VS 2015和IIS express中运行良好的开发机器。
但是当我在IIS服务器(IIS 8)中部署代码并设置我的appppol时。 当它检查目录是否存在或没有失败并且不保存图像时。 在共享路径中。我试过从服务器访问共享路径我可以打开它而没有问题
我已经应用了日志来检查但是它失败了该目录没有退出 Sharepath ex:\ atse-bs-13450.abc.xyz.com \ Sharefolder \ PhotoImages
我的应用程序池设置为ApplicationPoolIdentity
public void WriteImage(string Location, string base64Image)
{
try
{
// Check if directory exist
if (Directory.Exists(Location))
{
//location value is set in appSettings;
//"\\atse-bs-13450.abc.xyz.com\Sharefolder\PhotoImages\"
string strImagePath = Location;
// Check file exist in location
if (!File.Exists(Location))
{
if (!string.IsNullOrEmpty(base64Image))
{
using (FileStream stream = new FileStream(strImagePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None))
{
BinaryWriter writer = new BinaryWriter(stream);
writer.Write(Base64String2Blob(base64Image));
}
}
}
else
{
strBlobLogMessage = "image file could not be stored on shared location , Share path location : ";
PathNotFound(strBlobLogMessage);
}
}
else
{
strBlobLogMessage = "image file could not be stored on shared location as path does not exists , Share path location : ";
PathNotFound(strBlobLogMessage);
}
}
catch (Exception ex)
{
throw ex;
}
}