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.

Friday, June 1, 2007

The wonders of "app_offline.htm" in ASP.NET application

app_offline.htm

If you want to kill someone trying to deploy or build or working with ASP.NET application, you can play this trick on him/her.

Steps:
1) Go to the root folder, which is the "Start up project" for their app
2) right click, select notepad and rename it as "app_offline.htm"
Thats all you are done.

When they trying to run the app, with the project (in which u created this htm file), as the startup project, it gives them an error message, which they cannot figure out unless they know about this file and look into the directory.

Pretty funny, interesting, wierd but I like it.