Strange and random occuring Assembly not found error - asp.net

I did a simple ajax services (json based) to get some data from database.
The problem stated below:
On localhost: while programming/editing the aspx page in visual studio and seeing the result in browser it works fine for say 5-6 times of editing the aspx page, and then just start failing. Until I go to my web service interface class do something (say just put a newline somewhere) and recompile it. The problem get fixed and the cycle goes on...
When I trace the failed requests in fire bug I found 500 internal server error:
[FileNotFoundException: Could not load file or assembly 'App_Web_lbgnha4m, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.]
*full stack trace below.
I am not sure, but looks like this file 'App_Web_lbgnha4m' is generated temporary because everytime I fix this error by recompiling the code. After some time it again comes back with new name 'App_Web_blahblahblah'
My biggest concern is that when I deploy the solution to my staging server. the service worked fine (say for a day) and then same error, quite surprised what goes wrong without touching a file once deployed). Obviously I can’t deploy the solution every day to fix this....
Any suggestions please help......
Full Stack Trace:
[FileNotFoundException]: Could not load file or assembly 'App_Web_lbgnha4m, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
[ServiceActivationException]: The service '/Website/RESTfulService.svc' cannot be activated due to an exception during compilation. The exception message is: Could not load file or assembly 'App_Web_lbgnha4m, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified..
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext)
at System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Try switching to an ASP.NET Web Application project.

Related

Error loading file or assembly in Web Application

i need some pro help here,
I'm trying to install the DevInfo 7 Web application on my server, had A LOT of problems with SQL Server and IIS, after 2 days, i managed to fix it, but now that IIS and SQL are working fine, i can't get past this error because i have no idea about this language (btw, i'll add some tags, but as i don't know this language, i'm not sure they are actually related to the question, if i chose a tag wrong, tell me that i take it of!)
If somebody can explain to me what's wrong, or how to fix it, i would appreciate, as i'm not creating a Web Application (i have no idea on how to do so), and only trying to install one, i may not understand (please be as simplistic as you can)
I dunno if this changes something, but i'm installing it on a Windows Server 2012, x64...
Here's the error:
Server Error in '/devinfo' Application.
Could not load file or assembly 'DI5_INIFile' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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.BadImageFormatException: Could not load file or assembly 'DI5_INIFile' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'DI5_INIFile' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'DI5_INIFile' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17
System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122
[ConfigurationErrorsException: Could not load file or assembly 'DI5_INIFile' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +12761078
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +503
System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +142
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +203
System.Web.Compilation.BuildManager.ExecutePreAppStart() +152
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151
[HttpException (0x80004005): Could not load file or assembly 'DI5_INIFile' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881540
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12722601
It sounds as if you have entered .net Version Hell. I've had this problem when there are conflicting dll versions.
Things to try:
1 - Clean your solution (Right click on the top of the solution tree in Visual Studio and click "Clean"), then do Rebuild All.
2 - If that doesn't work, clean out the ../bin/Debug folder for you project, and repeat step 1. If this is a web application and you have a local version of IIS running, you should consider doing an IIS reset first. This will release any locks that processes may have on dlls in your bin folder.
3- In addition to step 2, you could clear out the ../obj folder too. The clean and rebuild should do this for you, however.
4 - One more thing to try is clear out the temporary asp.net files:
del /F /Q "%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files"
5 - Failing that, you will need to look at which project is trying to reference 'DI5_INIFile' and check its version number (right-click on the dll > properties > version) and see if it's in your web.config under a different version number.
If it is, you could remove the referenced assembly from your project and try to re-add it again.
Hope that helps!

ASP.NET web forms throws MVC dependency error at runtime

I have a tiny ASP.NET web app that runs fine on windows 7 but fails to run on Windows 2008 R2 with this error. I can't get around why I'm seeing MVC dependency error.
Using .NET 4/VS 2010.
Exception information:
Exception type: ConfigurationErrorsException
Exception message: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.AssemblyInfo.get_AssemblyInternal()
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)`enter code here`
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
This is most likely caused by sub application config file inheritance. The parent config file has a reference to a library that the sub application doesn't have.
Try to insert this line under system.web --> compilation --> assemblies
<remove assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Are you deploying System.Web.Mvc with your site, or, are you relying on GAC'd copy on your dev machine? You can follow this blog post to bin deploy mvc3 to a server, or you can install mvc3 on the target server using the web platform installer.
If MVC3 is already installed, and you you need to see more details about binding errors, you can enable the fusion log on the target machine.

Dependencies not loading or partially loading

I am trying to work with the MS Lync UCMA 4.0 sdk and just switched to using Visual Studio 2012 (becuase .NET 4.5 Framework is required). I can't figure out what is going on here, I've set the Target CPU to x64 and the Target Framework to .Net Framework 4.5 because I was getting the error:
"Could not load file or assembly 'SIPEPS, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
Now that I've made these changes I get the below error.
Server Error in '/' Application.
--------------------------------------------------------------------------------
Could not load file or assembly 'Azure' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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.BadImageFormatException: Could not load file or assembly 'Azure' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Azure' could not be loaded.
=== Pre-bind state information ===
LOG: User = CREATIVE\kielhowell
LOG: DisplayName = Azure
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Azure | 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:/Visual Studio Projects/TPL/
LOG: Initial PrivatePath = C:\Visual Studio Projects\TPL\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Visual Studio Projects\TPL\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\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/kielhowell/AppData/Local/Temp/Temporary ASP.NET Files/root/186577b4/cde0def/Azure.DLL.
LOG: Attempting download of new URL file:///C:/Users/kielhowell/AppData/Local/Temp/Temporary ASP.NET Files/root/186577b4/cde0def/Azure/Azure.DLL.
LOG: Attempting download of new URL file:///C:/Visual Studio Projects/TPL/bin/Azure.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'Azure' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
[ConfigurationErrorsException: Could not load file or assembly 'Azure' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +258
System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
[HttpException (0x80004005): Could not load file or assembly 'Azure' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +456
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
I had a very similar problem. I found the problem was that it couldn't find the dependency, and I was able to find out which one by using a dependency walker.
Link
You can open your .exe here, and it'll point out what you're missing in your project. For me it was the Microsoft C++ redist.
I had a similar issue after I copied my test code from my local machine to the trusted application server. I had to remove the Microsoft.Rtc.Collaboration dll reference from the project and browsed it in the application server and re-linked it.

"Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format."

while debugging in VS, the error will be raised when starting debug in VS.
The error is below:
Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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.BadImageFormatException: Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
[ConfigurationErrorsException: Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +232
System.Web.Compilation.BuildManager.CompileGlobalAsax() +51
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +337
[HttpException (0x80004005): Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729
[HttpException (0x80004005): Could not load file or assembly 'p4dn, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8921851
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259
When i create a C# project which use 'p4dn.dll' there isn't this error coming across.
this is my first ASP project, i also read the similar questions like "http://stackoverflow.com/questions/41449/i-get-a-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-error-o" and "http://stackoverflow.com/questions/1648213/could-not-load-file-or-assembly-xxx-or-one-of-its-dependencies-an-attempt-was". They cannot address my problem.
how can I solve this problem?
There is now a menu option to run the 64bit version of IIS Express.
From Visual Studio menu select Tools -> Options... -> Projects and Solutions -> Web Projects
Click the button for "Use the 64 bit version of IIS Express for web sites and projects"
Go to Respective ==> Site Application Pool ,
Click on ==> Advance Settings
Change value of ==> "Enable 32-Bit Applications" from False to True
I had this same error message trying to run (debug) a 64-bit MVC site using IIS Express 8.0. I verified that all my projects were targetting the x64 Platform.
The problem was occurring because Visual Studio runs the 32-bit version of IIS Express. The only way I could get it to work was to run the 64-bit IIS Express by executing the following command manually.
"C:\Program Files\IIS Express\iisexpress.exe" /config:"U:\IISExpress\config\applicationhost.config" /site:"Imaging.Web" /apppool:"Clr4IntegratedAppPool"
Then in your Visual Studio web project go to Properties, select "Use Custom Web Server", and enter the url to your site.
In order to Debug, go to debug > Attach to Process.. and then select your running IIS Express instance.
The Visual Studio team really should make this an option in the Project Properties.
-create a new IIS pool for your web site
-Enable 32bit for this pool
Localization project on Asp.Net with C#
Project was working fine on Local Machine. After uploading on IIS and Web Server, it did not worked and Could not load file or assembly 'App_global.asax' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. was coming.
After changing Application Pool to V4.0 from v2.0 on IIS, the error got resolved.

Error Message: Could not load file or assembly 'Delete ReportingContents'

I've just got an error message that was somewhat unexpected:
Error Message: Could not load file or
assembly 'Delete ReportingContents' or
one of its dependencies. The located
assembly's manifest definition does
not match the assembly reference.
(Exception from HRESULT: 0x80131040)
I've got an ASP.NET website that has abotu 10 projects makign it up which are compiled into DLLS and in the bin directory. ReportingContents is one of these projects. In the past I have had success in copying over a new version of the files (dll, pdb and xml) to the bin directory and recycled the app pool and it just picks up the new version on its own. This time I thought "I shouldn't have a debug version on the site" so I built as release and just copied up the dll and xml files and asked our deployment people to remove the pdb.
When I was told it was all done I tried to access the site and got the above error message.
The thing that surprises me is that the assembly it mentions is "Delete ReportingContents" and I don't know where the "Delete " might have come from in there.
I'm not sure what could have gone wrong. so I'm hoping that you can help:
My options are:
1) I should have used a debug version since that is what was there already.
2) My deployment guy failed to delete the pdb that was no longer relevant.
3) The code wasn't properly refreshed by the app pool recycle and it was expecting the old dll and getting the new one
4) Something went wrong elsewhere that really shouldn't have done.
Any thoughts or suggestions greatly appreciated... I need to deploy this code and don't really dare to do so again until I know what went wrong the first time...
Its worth mentioning that I only have access to the live environment through somebody else so I can't easily check anything on there myself.
And in case its useful here is the accompanying stack trace:
Error Target: System.Reflection.Assembly _nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.Assembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean)
Stack Trace:
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
It seems the answer was obvious in retrospect. Rather than deleting the files I wanted replaced he renamed them to "Delete ReportingContents" and then copied in the new ones. Of course this meant they got loaded and I assume complained that the filename wasn't right or something like that. the upshot of it is that when I got him to delete them properly it all worked.

Resources