Thursday, December 11, 2008

ArgumentNullException raised by Profile when deploying a web project

Your ASP.NET web site works perfectly in your development environment and you build a Visual Studio Web Deployment Project to deploy it in a production environment. You launch the default page and you get:

Value cannot be null.
Parameter name: type

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.ArgumentNullException: Value cannot be null.
Parameter name: type

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:

[ArgumentNullException: Value cannot be null. Parameter name: type]
System.Activator.CreateInstance(Type type, Boolean nonPublic) +2843963
System.Web.Profile.ProfileBase.CreateMyInstance(String username, Boolean isAuthenticated) +76
System.Web.Profile.ProfileBase.Create(String username, Boolean isAuthenticated) +312
System.Web.HttpContext.get_Profile() +108
Global.Application_AcquireRequestState(Object sender, EventArgs e) +72
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

The solution to this problem is hidden in the Web Deployment Project property pages. Select the "Output Assemblies" node under "Configuration Properties" and below the "Merge all outputs to a single assembly" option, uncheck "Treat as library component (remove App_code.compiled file)".


Anonymous said...

I'm having this problem, I did what you said, clearing the
"Treat as library component (remove App_code.compiled file)", but still the same problem, use the VS2008.

Please help me ...
My email:
'm from Brazil

Jacques L. Chereau said...

Did you do it for all configurations including Release and Debug?

Shalini said...

Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
Digital Marketing Company in India
seo Company in India

Vignesh PV said...

Learning new technolgy would help oneself at hard part of their career. And staying updated is the only way to survive in current position. Your content tells the same. Thanks for sharing this information in here. Keep blogging like this. Android Training in Chennai