Reputation: 6850
I'm getting the below error on a brand new production machine running windows server 2016. The below dll is from a nuget reference from Spitfire (https://github.com/RainwayApp/spitfire). The exact same code runs perfectly fine on my Windows 10 dev machine.
How do I figure out what is wrong on the production machine?
System.IO.FileNotFoundException: Could not load file or assembly 'Spitfire.dll' or one of its dependencies. The specified module could not be found.
File name: 'Spitfire.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Owin.Loader.DefaultLoader.AssemblyDirScanner.<GetEnumerator>d__1e.MoveNext()
at Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict)
at Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors)
at Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails)
at Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails)
at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveApp(StartContext context)
at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options)
at Communication.WebRTC.WebRTCHandshaker.WebRTCLoop(String url) in F:\SW\DedicatedServer\Communication\WebRTC\WebRTCHandshaker.cs:line 56
Update 1
Used .NET assembly dependency walker on the spitfire.dll. on my LOCAL machine Got this result. Nothing sticks out to me. Doing the production server shortly and will update.
Update 2:
Not sure what I'm supposed to be seeing, but this is from the production server.
Update 3:
Printing the below values both yield the correct values to the working folder or exe on the production server.
System.Reflection.Assembly.GetEntryAssembly().Location.ToString()
Environment.CurrentDirectory
Upvotes: 1
Views: 1211
Reputation: 6850
The problem was missing VC++ redistributable. After installing vc_redist.x64.exe everything worked.
Upvotes: 0
Reputation: 1224
How are the binaries deployed on the production machine? Are you using an installer? Is the dll packaged in the installer? Can you see the dll in the install path for your application?
Update: Most likely the Environment.CurrentDirectory under which the application is run is not the application install path on the production server. Write the Environment.CurrentDirectory to a console/log file and compare the output to the install directory.
See this question if you need to find the install path of your application during runtime.
Upvotes: 2
Reputation: 1845
This usually happens when one of the dependencies fails to load.
Check for a .NET assembly dependency walker (e.g. depends.net) and check the DLL. You need to run this check on the production server.
Upvotes: 2