Wednesday, March 7, 2012

Error connecting to ASPNETDB - Cannot open database

Hi everyone, i have already created posts about this problem and im aware theres millions of replys, but i still cant get this to work and its driving me mad. The posts i have seen i dont understand?

Im using the standard ASPNETDB Database, i have never opened up SQL Server Management studio, although i do have the express edition.

i have tried everything and i am totally stumped as to what to do. Heres my web.config.

It works in VWD 2005 Express, but not in WWWROOT or on webserver?

PLEASE PLEASE PLEASE Can someone help me!!!!!!!!!

Dan :)

<?

xmlversion="1.0"?>

<

configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<

appSettings/>

<

connectionStrings>

<

addname="northwindsConnectionString1"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient" />

<

addname="ConnectionString"connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\MyDatabase.mdb;Persist Security Info=True"providerName="System.Data.OleDb" />

</

connectionStrings>

<

system.web>

<

profile>

<

properties>

<

addname="FullName"defaultValue=""/>

</

properties>

</

profile>

<

roleManagerenabled="true" />

<

compilationdebug="false" />

<

authenticationmode="Forms" />

</

system.web>

</

configuration>

Are you sure that your provider supports SQL express and Access type database on web server?

Thanks

|||

Hi jpazgier, thanks for the immediate response.

The website im creating uses access databases fine. The thing that confuses me is that it runs under visual web developers development server, but if i put the app in the WWWROOT folder on my C:/ it doesnt work, same as if i upload it to my webserver. I emailed my hosting company and they provided me with this error (sorry its longwinded.)

Thanks mate,

Dan

----------

Here is the error the page is throwing:

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
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.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

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:


[SqlException (0x80131904): Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.]

|||

Maybe it is connected with security settings Web developer works inder your account IIS under ASP.NET

Janusz

|||its really confusing, what i dont understand is if i configure a setting on my local machine, what happens when i upload it to mywebserver?|||

The error you get has been driving people crazy for months.

Any way, When on a server IIS uses a generic account to access the file system. On your compurer IIS uses Your account.

In the connection string you have user instance =true so it is a problem with the the generic account not having a profile on the server.

If it is your server you can create an admin account and tell the application to use it instead of the gerneric one. It is a two part process, 1 create the accout on the server, 2 set the identity in the web.confg

Idealy you should attach the database to the sql server and access it that way. I had some problems with the profile provider doing it that way though.

I know this isn't a detailed solution but maybe you'll at least understand the problem better.

|||

Hi mate, thanks for replying, i dont have the option to create an admin account i dont think as its not my server.

I will try the other stuff that you have said, one other question i have is, that im using the ASPNETDB for the logins, but i have my own seperate database for holding information to do with the site im building. Now im only aloud to have one sql server database file on the server, so i need to join them together to make one database. Is this what you mean by attaching?

Thanks loads for your help

Dan

No comments:

Post a Comment