0

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?

Dave New
  • 38,496
  • 59
  • 215
  • 394
  • I guess it would be good to know the Azure SDK version and when exactly and how you face the error. – sharptooth Jul 23 '13 at 05:44
  • Sorry about that! Updated question. – Dave New Jul 23 '13 at 08:37
  • You likely even have a callstack visible in the browser. – sharptooth Jul 23 '13 at 09:07
  • Oh great, how is this question different from these two? http://stackoverflow.com/questions/17788699/microsoft-visualstudio-profiler-missing-when-running-in-compute-emulator and http://stackoverflow.com/questions/17786481/could-not-load-file-or-assembly-microsoft-visualstudio-profiler – sharptooth Jul 23 '13 at 09:08
  • 1
    Anyway this can be a 32-bit v 64-bit conflict http://stackoverflow.com/questions/11370344/could-not-load-file-or-assembly-an-attempt-was-made-to-load-a-program-with-a – sharptooth Jul 23 '13 at 09:13
  • The questions are essentially the same, but posed different and posted at different times. I am hoping to reach out to anybody and everybody. I have designed and ported our system to Azure (which has gone very well until now), and it is meant to be going live now. This problem has just cropped up and I have no idea what to do. And have uninstalled, reinstalled and scoured the Internet for days now. – Dave New Jul 23 '13 at 09:48
  • Reposting the same question rarely helps. What about the "32-bit v 64-bit conflict" idea? – sharptooth Jul 23 '13 at 10:02
  • I am checking it out as we speak. Thanks for the suggestion. Will let you know. – Dave New Jul 23 '13 at 10:21

2 Answers2

1

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.

astaykov
  • 30,768
  • 3
  • 70
  • 86
  • Thanks for this answer. It didn't solve my problem (I will post my solution soon), but was still useful to know about theses IIS options. – Dave New Jul 24 '13 at 05:07
0

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.

Dave New
  • 38,496
  • 59
  • 215
  • 394