这是我的连接字符串:如何配置SQL Server与ASP.NET MVC一起使用Windows身份验证?
<add name="MyDb" providerName="System.Data.SqlClient" connectionString="Server=localhost;Data Source=.\MSSQLSERVER;Initial Catalog=MyDb;Integrated security=SSPI;" />
它的工作我的本地机器上就好了,但我的服务器上,部署我的应用程序后,它不想工作,它给了我这个错误:
[SqlException (0x80131904): 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: 25 - Connection string is not valid)]
当我更改连接字符串以使用帐户凭证-sa,它连接的很好,所以我确切地知道这是错误的sql服务器配置的问题。
所以我的问题是:我已经新安装的SQL Server实例,如何配置它,所以它允许Windows身份验证我的asp.net MVC应用程序?
编辑:好吧,毕竟,我再次查看了我的连接字符串,并删除了Data Source =。\ MSSQLSERVER。它帮助了,现在一切正常,谢谢你们的帮助。
这是什么,谢谢。无论如何,我像你说的那样做了,并且有叫'IIS APPPOOL \ DefaultAppPool'的用户。我也改变了我的应用程序从defaultapppool运行(btw defaultapppool被列为本地服务)。但我仍然得到同样的错误。我现在能做什么? :/ – ojek 2013-02-17 17:56:49