开发者

asp.net mvc unable to connect to SqlServer when creating the users from Register page

开发者 https://www.devze.com 2023-03-18 15:22 出处:网络
I have Visual studio 2008 and Installed MVC2 RTM. For data base I have Sql Server 2008. When I first create a project of type \"asp.net mvc web application\"

I have Visual studio 2008 and Installed MVC2 RTM. For data base I have Sql Server 2008.

When I first create a project of type "asp.net mvc web application" I get the default structure of the project and app_data. After I run the project and trying to Register a new user It is giving the following error.

The user instance login flag is not supported on this version of SQL Server. The connection will be closed.

The above message is displayed, while the connection string value is

<connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>

I'm getting the below error when data source=.\SQLEXPRESS

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance S开发者_StackOverflow社区pecified)

Any Idea Why it is not connecting to the data base?

Thanks in advance.


It looks like you're using a full SQL Server.

Based on the link in Anand Kumar M's comment, you can't use AttachDBFilename when you're using a full SQL server, so try removing that from your connection string and attaching the database to your SQL server

For attaching the database to your SQL Server instance.
http://msdn.microsoft.com/en-us/library/ms190209.aspx

Once you've done that, remove the AttachDbFilename clause from your connectionstring and replace it with the following:

Initial Catalog=Mydatabase;

Where MyDatabase is the name of the database as it shows in SSMS.

Hope this helps

0

精彩评论

暂无评论...
验证码 换一张
取 消