Asp.net 在服务器上运行的应用程序-can';无法连接到其他本地数据库
我将我的MVC4网站放在运行IIS7.5(.NET4.0)的开发服务器上,它可以很好地指向服务器数据库或我自己指定为[Machine Name][Sql Instance]的本地数据库。应用程序在服务帐户下运行的应用程序池中。我确保用户已将该服务帐户添加到其SQL登录中并授予dbo权限 当我更改连接字符串以使用其他用户的计算机,并指定[machine name][sql instance]时,它会抛出一个错误 错误是:Asp.net 在服务器上运行的应用程序-can';无法连接到其他本地数据库,asp.net,sql,asp.net-mvc,entity-framework,asp.net-mvc-4,Asp.net,Sql,Asp.net Mvc,Entity Framework,Asp.net Mvc 4,我将我的MVC4网站放在运行IIS7.5(.NET4.0)的开发服务器上,它可以很好地指向服务器数据库或我自己指定为[Machine Name][Sql Instance]的本地数据库。应用程序在服务帐户下运行的应用程序池中。我确保用户已将该服务帐户添加到其SQL登录中并授予dbo权限 当我更改连接字符串以使用其他用户的计算机,并指定[machine name][sql instance]时,它会抛出一个错误 错误是: [SqlException (0x80131904): A network-
[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)]
[EntityException: The underlying provider failed on Open.]
[HttpException (0x80004005): Error executing child request for handler
'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.]
这是连接字符串:
<add name="ProjectUI" connectionString="metadata=res://*/ViewModels.
ProjectUI.csdl|res://*/ViewModels. ProjectUI.ssdl|res://*/ViewModels.
ProjectUI.msl;provider=System.Data.SqlClient;provider connection string="data
source=MYMACHINEID\MSSQLSERVER;initial catalog=DBName;integrated
security=True;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
我尝试过的事情:
- 我已验证SQL Server上是否启用了远程连接
- 启用的TCP/IP端口
- 在防火墙中为SQL server入站规则添加了异常
- 已向具有dbo权限的本地数据库添加服务帐户
- 启用TCP/IP(和命名管道)
- 重新启动SQL Server服务
- 确保已将服务帐户添加到数据库并授予相应的权限
- 不需要更改防火墙设置(不允许有比以前更多的规则)
- 连接字符串修改为:data source=UserMachineID,不带服务器实例(因为它是MSSQLSERVER的默认实例)