I added a reference to a DLL in my ASP.Net app. That started causing a BadFileFormatException, so I switched my app to target x86. I'm now getting this error:
System.IO.FileNotFoundException: Could not load file or assembly 'TheDLLThatIReferenced.dll' or one of its dependencies. The specified module could not be found.
The DLL in question is present in both the bin directory, and in bin\x86\Debug in my app's directory on the server. When I try to run my app out of Visual Studio, it runs just fine, but if I try to hit it via the internet, I get that error.
What might be causing this error, and how can I correct it?
Every time I've seen this it has boiled down to the assembly not being where it ought to on the server.
Have you confirmed that the web site you are hitting on the server is actually pointed at the directory you are looking at?
put validateRequest=false on asp.net page that is throwing Java.io.FileNotFoundException.
Related
I have created a .NET Framework 4.7.2 website with a WCF service. To expose data through this service, I have to reference a third party DLL with Copy Local = False from C:\InstallLocation. The website is loading this DLL at runtime, but I get an error when accessing functionality in the DLL that requires it to load a secondary DLL in the same InstallLocation folder. I verified with Process Monitor that W3WP.exe is finding the primary DLL at C:\InstallLocation, but that W3WP.exe fails to look in C:\InstallLocation at all for the secondary DLL. The application error is the expected,
Could not load file or assembly '[assembly-info-ommitted]' or one of its dependencies. The system cannot find the file specified.
I also tested the exact same type of reference in a Console Application which worked without issue. Process Monitor showed the executable looking in C:\InstallLocation for the secondary DLL.
Is there a way to configure the .NET web app to allow the process to look in the same directory as the referenced, primary DLL? I have tried the following without (full) success:
Adding C:\InstallLocation to my system Path (and restarted). Seemed to have no affect. I verified on application start that the added path did appear in Environment.GetEnvironmentVariable("PATH").
Moved C:\InstallLocation into my web root and tried <probing privatePath="CopiedLocation". This got past the initial DLL reference issues, but still showed an error but on a different dependency for a different DLL. I don't think this will be a viable workaround.
Movied C:\InstallLocation to the bin folder and commented out . Same result as the above.
Gave the app pool user full permission to C:\InstallLocation. Users: IIS APPPOOL\{web site name}, IUSR, IIS_IUSRS
Edit
I have implemented an initializer as shown here, https://stackoverflow.com/a/16867088/2544926. I have changed the code to check if a DLL exists in C:\InstallLocation to load the DLL from that folder. From Process Monitor output, it would seem this is getting me closer. However, I am seeing an error later in the process. Here is the error that I am seeing now (multi-level exception).
The type initializer for '<Module>' threw an exception.
A nested exception occurred after the primary exception that caused the C++ module to fail to load.
The type initializer for '<Module>' threw an exception.
The C++ module failed to load during vtable initialization.
Could not load file or assembly 'XYZ, Version=N.N.N.N.N, Culture=neutral, PublicKeyToken=NNNNNNNNN' or one of its dependencies. The system cannot find the file specified.
Interestingly, in my custom Assembly Initializer code, I see XYZ.DLL being loaded from C:\InstallLocation. Is it possible this C++ module is attempting to load it differently or in a way that isn't supported by ASP.NET?
I am a new bee to web services and I have to publish a web service to a server.
I added an application using IIS but when I try to browse the application it gives me this error.
Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies. The system cannot find the file specified.
I had seen other answers about this issue,where most of them are related to installing Microsoft.AI.Web package. This is already installed in my web service and I am still getting the error.
Thanks in advance for any suggestions to resolve this.
There was an update waiting on the Nuget package manager for Microsoft.ApplicationInsights, after updating it added the application again to IIS. This resolved my error.
I deployed my multi-tier application to azure. It was working perfectly, but now when I try to deploying it, it shows an error saying:
Could not load file or assembly 'MySomething.dll' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
I checked other answers, but all of them dealing with IIS. Azure Web Apps IIS cannot be accessed directly. How can I resolve this?
As usual, this issue happened because of caching. Removing the bin/obj directories alongside the IIS Express cache folder fixed the issue.
I am trying to deploy an ASP.NET 5 application to my 64-bit Windows Server 2008 R2 server. I created a blank web application and set up a file system publish profile using dnx-clr-win-x64.1.0.0-beta4. I copied the results from the publish location to a folder on my server and created a new virtual directory with a .NET 4.0 app pool pointing at the wwwroot folder of my application. However, when I try to browse to the site, I get this error:
Could not load file or assembly 'dnx.clr.managed' or one of its
dependencies. The system cannot find the file specified.
Description:
An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details:
System.IO.FileNotFoundException: Could not load file or assembly
'dnx.clr.managed' or one of its dependencies. The system cannot find
the file specified.
The same steps on my local PC (where I have Visual Studio 2015 installed) work correctly so it seems like I need to install something else on my server. I have already installed .NET 4.6 on this server without success. Does anyone know what I am missing?
I found the solution thanks to this question: Azure deployment : Could not load file or assembly 'dnx.clr.managed' or one of its dependencies. The system cannot find the file specified
At first I thought that wasn't the answer because it didn't work when I changed my publish profile from dnx-clr-win-x86.1.0.0-beta4 to dnx-clr-win-x64.1.0.0-beta4. However, I later noticed that approot/packages folder didn't have the x64 package. So I deleted everything and re-published with my new profile and the page loaded.
Change the dependencies file to the current version, whether it is 1.0.0-beta7 or 1.0.0-beta6 ensure that you go to nuget package manager and install the appropriate version rebuild the solution you should see file updates from your output windows.
Using .NET 4.0, I have a small ASP.NET app that utilized the ReportViewer object, I have created a web page that takes some user input and generates a report that is displayed using the ReportViewer control with ProcessingMode set to local.
Naturally, it works perfectly when run via VS 2010 in debugging mode and if I publish it to IIS running on my local machine. However, when I push it to production, I get the following error when actually trying to run the report
For the image impaired:
Failed to load expression host assembly. Details: Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
I have verified that the assembly (as well as the other reportviewer dependencies) is in the GAC. There don't seem to be any errors in the event log on the server.
Any ideas what the permission problem might be?
What authentication are you using in IIS? (e.g. windows, anonymous, ASP.NET impersonation)
As it happens, the production environment I was deploying to is a web farm and the virtual directories point to a location on a network drive. When I tried deploying to a non farm server, with a virtual directory located on the server itself, this worked. The permissions are identical in the two environments, so I can only assume that something about this control didn't like being located on a different box than IIS and ASP.NET.
I'm not sure if this is actually an "answer", so apologies in advance if I've handled this wrong from a stackover perspective.