Thursday, June 21, 2007

System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.We

Error: System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Web.Profile.ProfileBase.CreateMyInstance(String username, Boolean isAuthenticated) at System.Web.Profile.ProfileBase.Create(String username, Boolean isAuthenticated) at System.Web.Profile.ProfileBase.Create(String username) at ProfileCommon.GetProfile(String username)

Core Problem:
If you have Profile Provider in your asp.net application and your deploy project's Configuration Properties, for the "Output assemblies" option has "Treat as library component(remove the App_Code.compiled file)" check box checked and you deploy it on a production machine.

Note: This runs fine on local machine.

Solution:
1) Right click on the deploy project in the solution explorer, select property pages
2) In the Configuration Properties, select Output Assemblies
3) Uncheck the "Treat as library component(remove the App_Code.compiled file)" check box.
4) rebuild and deploy.

The explanations for the problem and solutions can be found at these links:
http://forums.l-space-design.com/blogs/day_of_the_developer/archive/2006/08/12/223.aspx

http://communityserver.org/forums/p/485257/571283.aspx

http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx

Hope this saves your time. I had wasted nearly a day with this problem, using profiler to check the sql server, etc.

Good luck.

No comments: