Forcing ASP.Net to use TCP/IP to connect to SQL Server instead of named pipes

試著忘記壹切 提交于 2020-01-01 04:51:05

问题


How can I force my ASP.Net application to connect to a SQL Server using TCP/IP, not Named Pipes?

I read somewhere putting "tcp:" in front of the server name in the connectionstring should do the trick, but it does not seem to change anything.

Edit1:

  • TCP/IP is enabled on the SQL Server.
  • I tried Network Library=dbmssocn in the connectionstring, I still get an errormessage about named pipes: "provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server"

Edit2:

  • Turns out my problem was another hidden connectionstring used by entity framework

回答1:


You can force it in the connection string:

server=tcp:hostname

Via: http://weblogs.asp.net/jgalloway/archive/2007/02/24/sql-force-the-protocol-tcp-named-pipes-etc-in-your-connection-string.aspx




回答2:


Use the SQL Server Configuration Manager on the client and disable the client protocols you don't want it to use.




回答3:


It depends how you're connecting to the database, but this should give the information you need.




回答4:


Just to add a quick hint, could cause issues, if you need to specify a port, do it after the IP address, and use a comma, not a colon.



来源:https://stackoverflow.com/questions/983605/forcing-asp-net-to-use-tcp-ip-to-connect-to-sql-server-instead-of-named-pipes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!