views:

285

answers:

3

So we're having some issues deploying an ASP.NET MVC app to a client site. Basically when we try to test the app from localhost, we get the dreaded Global.asax parser error indicating it could not load the application global.

Research indicates there are basically 4 possible reasons for this exception we're seeing:

  1. The solution hasn't been built. This clearly isn't the case since we can deploy it here and it runs fine on any machine we deploy to AND we had to build and publish the darn thing to deploy it anyway.

  2. The Global.asax namespace inheritance does not match the application global code file. Again we double checked this and since it runs just fine here that can't be the issue.

  3. Miscellaneous non-descript IIS/VS.NET mischief. Basically something get's wonky in IIS or VS.NET and the web server won't behave correctly for this application. We've done cleans and rebuilds, we've deleted virtual dir and recreated, and performed all of the IIS munging that we've found elsewhere online. Various combinations of IIS bounces, server reboots, virtual dir/application recreation, etc.

  4. Code level permissions issue. We've verified full trust in machine/web config in the framework directory, we've set .NET trust to full in IIS, we've granted Everyone full control on the directories just to hit it with the security hammer, etc. etc.

The pertinent detials: Windows Server 2008 x64 IIS 7, 32 bit compatible app pool (app was written on 32 bit OS compiled for any cpu) App pool identity set to NetworkService Microsoft ASP.NET MVC 1.0 XCopy deployment

We deployed another read-only app just fine. The significant difference in this app is the use of NHibernate and Log4Net which require full trust. Additionally, the actual project name of the web project differs from the default namespace however the Inherits namespace in Global.asax and the Global.asax.cs files match so this shouldn't be an issue.

Anybody have any bright ideas? We're officially down to just the dim ones.

EDIT Exception is Could not load type <MyDefaultNamespace>.<Global.asax.cs class name>

There is no code snippet as the app won't load at all. It fails immediately with no time lag on first request after install.

It's the same thing all these folks over here are having trouble with

A: 

can u post the exact exception and maybe code snippet or the stack?

Try removing the CodeBehind="" in the global.asax markup, rebuild each assembly one by one then republish and try that. Do you see anything in the Event log?

DustinDavis
It's on app load, so I'm not sure a code snippet would help, but I'll dump the exception in my post.
mannish
Are you sure that all of your assemblies are being copied to the output directory? Check the properties of your references.
DustinDavis
A: 

Exception is "Could not load type <MyDefaultNamespace>.<Global.asax.cs class name>"

There is no code snippet as the app won't load at all. It fails immediately with no time lag on first request after install.

It's the same thing all these folks over here are having trouble with

+1  A: 

If you have changed the solution platform, try changing it back to Any CPU.

I had mine set to x86 (one I had created to allow code changes during debugging on x64 computer). When I changed it back to Any CPU the the problem you described went away.

Mr. Flibble