无法在网络驱动器中找到图像

时间:2014-01-20 13:10:03

标签: c# image asp.net-mvc-4 networking file-io

我知道这个问题曾多次询问,但当时没有一个问题能解决我的问题。

我有这个简单的代码

   Image f = Image.FromFile(@"\\NetWork\imagenes\folder0\1690D-PC.tif");

但它抛出:

System.IO.FileNotFoundException \\NetWork\imagenes\folder0\1690D-PC.tif
  1. 我对相关网络的访问权限
  2. 我可以在该位置找到图片。我复制路径,START + r,粘贴路径并打开图像。
  3. 该服务器中的所有图像都相同。
  4. 但情况不仅存在:

    1. 我在另一台电脑上测试过以检查是否是IIS问题或 无论如何,但是当我测试时抛出相同的东西(2个人无法访问 那个文件,让他们完全访问......很奇怪...)
    2. 当我在开发中时,我发现图像一切正常,但当我部署时 上传到我的本地iis和另一台电脑,抛出相关的异常(FileNotFoundException)。
    3. 我的parner有相同的代码(几乎相同的proyect,只是一些 不同的功能和公共)他可以找到图像和 显示它。
    4. 上周五我遇到了这种情况,我还没有提出解决方案。

      我愿意听取你的所有建议。

      更新2。 更多信息:

      还有2个应用程序从该服务器请求图像,这些应用程序可以正常找到它。 这些应用程序位于我的本地IIS中。

      Updte

      Tracktrace

      [FileNotFoundException: \\DAVID-PC\imagenes\folder0\1690D-PC.tif]
         System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement) +472351
         System.Drawing.Image.FromFile(String filename) +6
         Muckup.Controllers.HomeController.Index() in C:\Users\pkm\Documents\Visual Studio 2010\Projects\Muckup\Muckup\Controllers\HomeController.cs:20
         lambda_method(Closure , ControllerBase , Object[] ) +62
         System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
         System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +211
         System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
         System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
         System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
         System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
         System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +48
         System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +57
         System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +223
         System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10
         System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
         System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +48
         System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
         System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +102
         System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
         System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43
         System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
         System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
         System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
         System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
         System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
         System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
         System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
         System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
         System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
         System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
         System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
         System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
         System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
         System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9514812
         System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
      

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用双反斜杠代替@来查找文件?可能值得一试。

 Image f = Image.FromFile(" *FullPath* \\NetWork\\imagenes\\folder0\\1690D-PC.tif");
相关问题