Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOException: The network name cannot be found

I running a C# MVC website written on C# for quite long time. Recently, I've noticed this log message in my logger data:

System.IO.IOException: The network name cannot be found.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.EnumerateFiles(String path)
   at System.Web.WebPages.Deployment.WebPagesDeployment.AppRootContainsWebPagesFile(String path)
   at System.Web.WebPages.Deployment.PreApplicationStartCode.OnChanged(String key, Object value, CacheItemRemovedReason reason)
   at System.Web.Caching.CacheEntry.CallCacheItemRemovedCallback(CacheItemRemovedCallback callback, CacheItemRemovedReason reason)

I also know:

  1. This exception is thrown from the ASP.global_asax file.
  2. This happen for one time in few weeks. But, when it's happen, I see this exception for few times in my logger (delay of a second between each exception).

As you can see, nothing in this call-stack is in my code. Therefore, I don't know how to repro this or solve this.

How do you recommend me to solve this? Any tip will be helpful.

like image 575
No1Lives4Ever Avatar asked Apr 05 '16 09:04

No1Lives4Ever


1 Answers

Looking at the source code, this exception is triggered by the framework itself.

It tries to enumerate all files in the HttpRuntime.AppDomainAppPath. It looks like this path is not always available in your scenario, which seems a little strange. Where are you hosting your files?

I suggest you to log the value of HttpRuntime.AppDomainAppPath and search from there. I think it will be a rather unusual value...

like image 100
Manuel Allenspach Avatar answered Nov 01 '22 13:11

Manuel Allenspach