The exception message is: Could not load file or assembly 'App_Code' or one of its dependencies. The system cannot find the file specified - asp.net

I am trying to visit a WCF service endpoint like xxx.svc. And I got this error:
The exception message is: Could not load file or assembly 'App_Code' or one of its dependencies. The system cannot find the file specified
I turned on the fusion log and got this:
=== Pre-bind state information ===
LOG: User = xxx\xxx
LOG: DisplayName = App_Code
(Partial)
LOG: Appbase = file:///D:/myService/
LOG: Initial PrivatePath = D:\myService\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\myService\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
I don't have the App_Code folder in my web application. Why does it look for App_Code???
Thanks!

I just figure it out after a good night sleep. I forget the precompiledApp.config file.

Probably you use an invalid reference or you are not referencing something you would like to use. The solution is to review your web.config and all references, searching for needed but missing references or invalid references.

Related

Azure Web Role with Transient Fault Handling Block exception: The path is too long after being fully qualified

We applied Transient Fault Handling Block for our web role of cloud service, we even didn't write one single line code. When we try to debug our cloud service locally, the exception would show on webpage, like this:
The path is too long after being fully qualified. Make sure the full
path is less than 260 characters and the directory name is less than
248 characters.
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.FileLoadException: The path is too long
after being fully qualified. Make sure the full path is less than 260
characters and the directory name is less than 248 characters.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ServiceBus' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ServiceBus
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ServiceBus | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/AzureCloudService2/WebRole1/
LOG: Initial PrivatePath = C:\AzureCloudService2\WebRole1\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\AzureCloudService2\WebRole1\web.config
LOG: Using host configuration file: C:\Program Files\IIS Express\config\templates\PersonalWebServer\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/<user>/AppData/Local/dftmp/Resources/7f758b78-aef1-47f7-ad86-8be56d4218e0/temp/temp/RoleTemp/Temporary ASP.NET Files/root/63defe93/23a6bb89/Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ServiceBus.DLL.
LOG: Attempting download of new URL file:///C:/Users/<user>/AppData/Local/dftmp/Resources/7f758b78-aef1-47f7-ad86-8be56d4218e0/temp/temp/RoleTemp/Temporary ASP.NET Files/root/63defe93/23a6bb89/Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ServiceBus/Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ServiceBus.DLL.
LOG: Attempting download of new URL file:///C:/AzureCloudService2/WebRole1/bin/Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ServiceBus.DLL.
LOG: Using application configuration file: C:\AzureCloudService2\WebRole1\web.config
LOG: Using host configuration file: C:\Program Files\IIS Express\config\templates\PersonalWebServer\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ServiceBus, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
ERR: Failed to complete setup of assembly (hr = 0x8007006f). Probing terminated.
From the logging, it seems couldn't find Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ServiceBus.dll in above locations, but actually it indeed located at C:/AzureCloudService2/WebRole1/bin/, I've checked it many times.
Several information:
We just install the packages via Nuget
We also tried other packages such as TransientFaultHandling.Caching .etc, all have such problems.
What's interesting is it works fine in worker role
#RandyLevy thanks for your comment, it solved my problem. You would win the bounty if you post it as an answer :)
It looks like the ASP.NET temporary directory is exceeding the max
path length. Take a look at Windows Azure - Resolving 'The Path is
too long after being fully qualified Error Message' to set the
_CSRUN_STATE_DIRECTORY environment variable. – Randy Levy

Intermittent Assembly Loading Error

We have a web application that utilises plugins. This system is used in many successfully deployed installations, but in one instance we are seeing an intermittent issue. Occasionally it will fail to load a user created plugin - see fusion log below. When it fails, the users switch servers to their redundant server and carry on, until the problem then manifests itself on the redundant server (no specific time between failures - could be hours up to weeks), and then switch back to the original server again (where again it will be fine). We've been supplied the source of the plugin and confirmed it's not an issue with the code/dll itself.
*** Assembly Binder Log Entry (2013-06-18 # 00:32:49) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = ***\***
LOG: Where-ref bind. Location = D:\Program Files\***\***\***\plugins\***.dll
LOG: Appbase = file:///D:/Program Files/***/***/***/plugins/
LOG: Initial PrivatePath = D:\Program Files\***\***\***\plugins\references\
LOG: Dynamic Base = NULL
LOG: Cache Base = D:\Program Files\***\***\***\plugins\cache\79797f4b-d645-4a33-ad9d-c75f1c548e15
LOG: AppName = ***
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: D:\Program Files\***\***\webfiles\web.config
LOG: Using host configuration file: \\?\C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL file:///D:/Program Files/***/***/***/plugins/***.dll.
LOG: Assembly download was successful. Attempting setup of file: D:\Program Files\***\***\***\plugins\***.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: ***, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
LOG: Re-apply policy for where-ref bind.
LOG: Where-ref bind Codebase matches what is found in default context. Keep the result in default context.
LOG: The post-policy assembly reference requires probing again.
LOG: Switch from LoadFrom context to default context.
LOG: Using application configuration file: D:\Program Files\***\***\webfiles\web.config
LOG: Using host configuration file: \\?\C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///D:/Program Files/***/***/***/plugins/***.DLL.
LOG: Assembly download was successful. Attempting setup of file: D:\Program Files\***\***\***\plugins\***.dll
LOG: Entering download cache setup phase.
ERR: Setup failed with hr = 0x80070002.
ERR: Failed to complete setup of assembly (hr = 0x80070002). Probing terminated.
Any thoughts on what could be causing it to fail in this way intermittently?
What is the signature of the assembly when it is loaded? You can find it by attachingvto debugger and viwing the modules loaded.
is it different is the string name when load fails?
also use fuslogview.exe as tool and keep logging all module load failures, when load fails, the fuslogview details will provide you enogh details as why the assembly load failed.

IIS cannot load global type despite of existing dll

I'm trying to get an application to run on an IIS 6.0 that I was assigned to support.
I copied all the source and binaries to the Inetput folder. The WebApp is running, but I get the error that tells me that the global type of the application could not be loaded.
How can I debug this? The namespace is correct, the DLL is present in the /bin/ folder of the application, and still the app cannot load it.
After turning on Fusion logging, I found this error file that concerns my global class;
*** Assembly Binder Log Entry (05.11.2012 # 08:45:30) ***
The operation failed.
Bind result: hr = 0x80131107. No description available.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = MyApplication
(Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/MyApplication
LOG: Initial PrivatePath = bin
LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\MyApplication\a1144233
LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\MyApplication\a1144233
LOG: AppName = 1ec25e47
Calling assembly : (Unknown).
===
LOG: Processing DEVPATH.
LOG: DEVPATH is not set. Falling through to regular bind.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: MyApplication
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/MyApplication/a1144233/1ec25e47/MyApplication.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/MyApplication/a1144233/1ec25e47/MyApplication/MyApplication.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/MyApplication/bin/MyApplication.DLL.
LOG: Assembly download was successful. Attempting setup of file: c:\inetpub\wwwroot\MyApplication\bin\MyApplication.DLL
LOG: Entering download cache setup phase.
ERR: Error extracting manifest import from file (hr = 0x80131107).
ERR: Setup failed with hr = 0x80131107.
ERR: Failed to complete setup of assembly (hr = 0x80131107). Probing terminated.
What's going wrong there? The bin\MyApplication.DLL exists and is compiled correctly, so I don't see the problem...
Reproducing the solution from the comments...
Step 1 is to enable Fusion Logging to get a log of what was failing
This produced the log file that indicates that IIS was trying to launch the DLL under version 1.1 of the .Net Framework. The error then occurred when it tried to read the manifest of the dll.
This indicates that the dll was from a later version of the framework and so couldn't be loaded.

asp.net mvc windows azure migration System.BadImageFormatException: Could not load file or assembly 'Interop.SSCE' or

Hi have follows the steps here
Link
to migrate an asp.net mvc project to windows azure, The project builds ok, I then hit f5 and I get the error above. Does any one have any ideas why this is happening? I am new to azure so Im not too familiar with the process, Any ideas would be appreciated thanks
Stack Trace
=== Pre-bind state information ===
LOG: User = IP-0AE2B2DF\Administrator
LOG: DisplayName = Interop.SSCE
(Partial)
LOG: Appbase = file:///C:/Users/Administrator/Documents/Visual Studio 2010/Projects/TestProject/src/TestProjectCloudService/bin/Release/TestProjectCloudService.csx/roles/TestProject.Web/approot/
LOG: Initial PrivatePath = C:\Users\Administrator\Documents\Visual Studio 2010\Projects\TestProject\src\TestProjectCloudService\bin\Release\TestProjectCloudService.csx\roles\TestProject.Web\approot\bin
Calling assembly : (Unknown).
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Administrator\Documents\Visual Studio 2010\Projects\TestProject\src\TestProjectCloudService\bin\Release\TestProjectCloudService.csx\roles\TestProject.Web\approot\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/Administrator/AppData/Local/dftmp/s0/deployment(3)/res/deployment(3).TestProjectCloudService.TestProject.Web.0/aspNetTemp/aspNetTemp/root/7dd3ee0f/d7fb43c0/Interop.SSCE.DLL.
LOG: Attempting download of new URL file:///C:/Users/Administrator/AppData/Local/dftmp/s0/deployment(3)/res/deployment(3).TestProjectCloudService.TestProject.Web.0/aspNetTemp/aspNetTemp/root/7dd3ee0f/d7fb43c0/Interop.SSCE/Interop.SSCE.DLL.
LOG: Attempting download of new URL file:///C:/Users/Administrator/Documents/Visual Studio 2010/Projects/TestProject/src/TestProjectCloudService/bin/Release/TestProjectCloudService.csx/roles/TestProject.Web/approot/bin/Interop.SSCE.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Fixed, just removed reference to the web role project duh!

Binding Microsoft.Web.DynamicData assembly at runtime failing

I've got a project using DynamicData that was wrote by somebody else. Every time i try debbuging it, I get the message I've attached at the bottom
I've already tried deploying the DynamicData dll to GAC, and throwing it into the bin folder, chceking the assemblies full names, installing again VS SP1, and .NET Framework SP1, and chceking the logs in Fuslogvw.
I've run out of ideas at this point. Could anybody help me, or at least suggest a new direction of searching for the solution ? Thx in advance.
The error message I get :
=== Pre-bind state information ===
LOG: User = DOMAIN\user
LOG: DisplayName = Microsoft.Web.DynamicData
(Partial)
LOG: Appbase = file:///C:/AppBase/
LOG: Initial PrivatePath = C:/AppBase/bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:/AppBase/bin/web.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
You might be able to use the AppDomain.AssemblyResolve event to learn more about the Assembly that's being requested. You can check that the version numbers and everything else match. If you have the dependency already loaded, then you can just return it from the event handler. I've included some sample code in this answer.

Resources