Question

I have a runtime error which is occurring only when I run my web application in the Compute Emulator:

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

enter image description here

I do not get this error when running the web application normally in IIS.

SDK version: 2.0

Where do I start to fix this problem?

Was it helpful?

Solution 2

I would love an explanation for this.

I had to manually delete Microsoft.VisualStudio.Profiler.dll from my bin directory. I don't know how it got there and there was nothing referencing it (I used NDepend to check this). Once removed, I stopped getting the error. Cleaning didn't remove the dll.

OTHER TIPS

Are you using IISExpress or full IIS? This is configurable by the WebRole's properties tab:

Configure IIS

The issue is that Visual Studio is 32bit and so (my speculation) its components. The easiest way to solve this problem would be to use IIS Web Server (full IIS) as opposed to IIS Express. The application pool defaults are set to use OS bitness, so on 64bit OS you got a 64bit Application Pool. When you use full IIS it is very easy to change Application Pool Defaults and enable 32bit Applications. This will force the application pool used for the local deployment to run under 32bits and will load the VS Profiling assemblies.

Here is general description how to enable 32bit web applicatopn on IIS

Here is more on setting the application pool defaults

You can also set the application pool defaults in the applicationhost.config file for the IIS Express. It is located in %USERPROFILE%\Documents\IISExpress\Config. Please refer to the latter link on how to manually add enable32BitAppOnWin64 in the applicationhost.config.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top