Please see the end of the post for a detailed pasting of the error and relevant sections of my web.config
I'm using VS2010, vb.net, .net framework 4.0, and SQL Server 2008 Express on Windows 7 Pro with all updates installed. I have developed a website that uses memberships, profiles, and roles. I allowed the built in providers to create the aspnetdb.mdf file for me in the App_Data folder. I added a number of my own tables to aspnetdb.mdf so I would have a single database for all my site's data.
I am hosting the site on my own server. It uses Windows 2003 Server, IIS 6, SQL 2008 Express, and all of my software including the OS is up to date with the the latest servicepacks, updates, and all of the .net framework updates including 4.0. There are no updates left to install and I'm sure that my issue isn't due to a missing update or framework version.
I copied the aspnetdb.mdf and .ldf files from my app_code folder to the sql server express folder on my server and attached the database. I do this because I don't want the file to autoattach, because I will likely use a commercial hosting service in the future. I added a sql server user with ownership rights to the DB. strong text
I then modified my connection string in web.config to point to the UNC of my SQL Instance on my server and to authenticate with the sql server username and password that I set up with ownership rights to that database. I updated my membership, role, and profile providers in my web.config file to use the new sql connectionstring and I was sure to include the application="/" setting and to use before each provider.
I can run the site just fine from my development machine. I can log on to it and use all of its features. However, when I publish the site to my server I can access the site, both locally over my intranet and over the internet. I can navigate around on it and it retrieves all of the data from the tables that I added to the database myself, but when I try to log on to it or to create a new account (basically anything that uses memberships, roles, or profiles) the site crashes with the error and all of the data below.
I've checked to verify that the application name in my aspnetdb database is in fact simply "/". I've ensured that I'm running from an application pool that is using the 4.0 framework. Much of the googling and reading that I've done seems to indicate a problem with my providers, but I can't understand why it works perfectly on Casini (or whatever the development server is called) on my local machine but crashes on my web server. In both cases they are connecting to the same database.
I would be so grateful if anyone could tell me what I'm doing wrong here. Following are the full error displayed by my server when the site crashes and also what I feel are the relevant sections of my web.config file.
Full content of error message and relevant sections of web.config are below:
Server Error in '/' Application.
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) +9643414 System.Web.Profile.ProfileBase.CreateMyInstance(String username, Boolean isAuthenticated) +79 System.Web.Profile.ProfileBase.Create(String username, Boolean isAuthenticated) +247 System.Web.HttpContext.get_Profile() +107 _perfect.get_Profile() +20 _perfect.Page_Load(Object sender, EventArgs e) +368 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +91 System.Web.UI.Control.LoadRecursive() +74 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Connection string and providers from web.config are below:
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=Server1\SQLEXPRESS; Initial Catalog=************; User ID=*******; Password=********" providerName="System.Data.SqlClient" /
</connectionStrings>
<roleManager enabled="true" defaultProvider="PerfectTenseRoleProvider">
<providers>
<clear />
<add name="PerfectTenseRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="ConnectionString"
applicationName="/"
/>
</providers>
</roleManager>
<providers>
<clear />
<add name="PerfectTenseProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="ConnectionString"
applicationName="/"
/>
</providers>
<properties>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
<add name="*****" type="string"/>
</properties>
</profile>
<membership defaultProvider="AspNetSqlMembershipProviderRelaxed">
<providers>
<clear />
<add name="AspNetSqlMembershipProviderRelaxed"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ConnectionString"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
applicationName="/"
/>
</providers>
</membership>