简体   繁体   中英

SSMS is OK but Local IIS Cannot Connect to SQL Server

I'm getting the dreaded "A network-related or instance-specific error" error but only when attempting to connect from my local IIS server. IIS and SQL are both installed on the same machine.

SQL Server (EXPRESS) is running and the SQL Server Browser is also running. Client Protocols (Shared Memory, TCP/IP, and Named Pipes) are all enabled. I can connect and run queries via SSMS both locally and remotely using both Named Pipes and TCP using either Windows Authentication (My Account) or a SQL Server login.

Here is the connection string I am using in my web.config

Server=(local)\SQLEXPRESS;Database=MyDbName;User ID=MyUsername;Password=MyPassword"
Server=(local)\SQLEXPRESS;Database=MyDbName;Integrated Security=True;

Any recommendations are appreciated:

  • Win Server: 2016
  • IIS: 10.0.14393
  • SQL Server Express: 14.0.1

已解决:这是由于仅用于代码迁移更新的附加连接字符串所致。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM