我有一个托管在共享服务器上的网站,我已经在服务器上安装了允许远程连接,也打开以允许远程连接。
我还关闭了防火墙。
当我在本地主机上运行我的网站时,我可以通过我们的静态ip和端口登录到我的SQL Server,而不是在我们的网络上的SQL Server Management Studio。
但是,当我将我们的网站发布到我们的托管服务器时,它将不会连接到我们的数据库并返回一个错误:
Win32Exception (0x80004005):尝试以其访问权限禁止的方式访问套接字
这是我们的连接字符串
Data Source=000.000.00.00,12341;Integrated Security=False;
User ID=myUserNmae;password=myPassword;Initial Catalog=dBaseName;
这里还会有什么问题吗?
发布于 2014-03-31 09:08:38
您可能必须打开程序,而不是(简单地)打开端口。
http://technet.microsoft.com/en-us/library/cc646023.aspx
To add a program exception to the firewall using the Windows Firewall item in Control Panel.
On the Exceptions tab of the Windows Firewall item in Control Panel, click Add a program.
Browse to the location of the instance of SQL Server that you want to allow through the firewall, for example C:\Program Files\Microsoft SQL Server\MSSQL11.<instance_name>\MSSQL\Binn, select sqlservr.exe, and then click Open.
Click OK.
你会特别想读到关于“动态端口”的文章
你能试试:
Data Source=127.0.0.1,12341;Integrated Security=False;
User ID=myUserNmae;password=myPassword;Initial Catalog=dBaseName;
机器有内部和外部IP吗?另外,您可能必须使用内部- IP (一个真正的IP,而不仅仅是127.0.0.1)作为连接字符串中的IP地址。
发布于 2014-04-01 07:49:17
如果这个问题也发生在你身上的话,来更新你所有的人。
我的网站由hostgator作为共享主机托管,他们声称,出于安全考虑,它们只允许通过端口1433完成sql的通信,这是sql的默认端口.希望这对将来的人有帮助。
https://stackoverflow.com/questions/22767562
复制