Friday, February 24, 2012

ASPNETDB - Unable to connect to SQL Server database

Hi Eevryone:

I seem to have corrupted my ASP.netWeb Site Administration Tool some how. It worked fine a few days ago, but reloaded SQL Server 2005 Express Edition W Adv Services SP1 yesterday I can not get past the "Unable to connect to SQL Server database" error. I have run the aspnetdb.exe and created both a aspnetdb.mdf and loaded the tables to into a existing mdf. I have checked all the permissions.

So any ideas on what I am doing wrong, or can you point me to some documentation on the 'AspNetSqlProvider'

Thanks in advance, Gene

You could erase the file in the appdata directory and it should recreate one fromscratch for you. actually, all you need is

<roleManager enabled="true" />

to get it to make the appdata express file

|||Exactly were do I am this entry?|||

Here is a very simple web.config with rolemanager enabled.

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<add name="FetchEmailConnectionString" connectionString="Data Source=TM8200;Initial Catalog=FetchEmail;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<roleManager enabled="true"></roleManager>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

|||

Thanks again for the help.

Your sample web.config helped prove what I was beginning to suspect yesterday. It is the creation of user instances under .SQLExpress that is causing my problems. This makes sense considering that it was after I switched to .SQLExpress from SQL 2000 that my problems started. Any suggestions on where to find good user instance documenation? So far I have not found any good trouble shooting articles.

Cheers, Gene

No comments:

Post a Comment