Azure Error: A network-related or instance-specific error occurred while establishing a connection to SQL Server

前端 未结 2 1261
遥遥无期
遥遥无期 2021-01-19 09:19

I have SQL server & web app hosted over Microsoft Azure platform. I am constantly getting above error when ever i run web application (and try to connect azure sql serve

相关标签:
2条回答
  • 2021-01-19 09:55

    you need to white your IP address for same, SQL azure will need to know the your Application IP

    0 讨论(0)
  • 2021-01-19 09:57

    From Mihaela's comment: You need to add "tcp: " in front of server name. I.e. tcp:<servername>.database.windows.net


    EDIT:

    This is specified in the [documentation] (https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx)

    Data Source must use the TCP format or the Named Pipes format.

    TCP format is as follows:

    •tcp:\

    •tcp:,

    The TCP format must start with the prefix "tcp:" and is followed by the database instance, as specified by a host name and an instance name.

    The host name MUST be specified in one of the following ways:

    •NetBIOSName

    •IPv4Address

    •IPv6Address

    The instance name is used to resolve to a particular TCP/IP port number on which a database instance is hosted. Alternatively, specifying a TCP/IP port number directly is also allowed. If both instance name and port number are not present, the default database instance is used.

    0 讨论(0)
提交回复
热议问题