在主机服务器上获取错误。购物车在本地机器上成功运行 [英] Getting an Error on host server. while cart is successfully run on local mechine

查看:57
本文介绍了在主机服务器上获取错误。购物车在本地机器上成功运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Server Error in '/' Application.
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: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: 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: 26 - Error Locating Server/Instance Specified)

Source Error:
[No relevant source lines]

Source File: App_Code.8ojkszie.1.cs    Line: 21

Stack Trace:
[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: 26 - Error Locating Server/Instance Specified)]





我的web.config是:





my web.config is:

<configuration>
  <connectionstrings>
    <add name="myConnectionString" connectionstring="Data Source=mydatasource.db.11311029.myresource.com; Initial Catalog=test; User ID=test; Password='test'; ">
     providerName="System.Data.SqlClient" /&gt;


  </add></connectionstrings>
 <system.web>
        <compilation debug="true" targetframework="4.0" />
   <anonymousidentification enabled="true" />
   <profile enabled="true">
     <properties>
       <add name="SCart" serializeas="Binary" type="ShoppingCartExample.Cart" allowanonymous="true" />
     </properties>
   </profile>
<authorization>
     <allow users="?" />
     <allow roles="admin" />
   </authorization>
   <rolemanager enabled="true" />
   <authentication mode="Forms" />
   <customerrors mode="Off" />
    </system.web>
</configuration>

推荐答案

作为maneavnash,ThePhantomUpvoter和ryanb31提到连接字符串错误:

As maneavnash, ThePhantomUpvoter and ryanb31 have mentioned the connection string is wrong:
Data Source=mydatasource.db.11311029.myresource.com





请看这里: http:// www.connectionstrings.com/sql-server-2008/ [ ^ ] - 部分:通过IP地址连接。





Have a look here: http://www.connectionstrings.com/sql-server-2008/[^] - section: Connect via an IP address.

Quote:

DBMSSOCN = TCP / IP是如何使用TCP / IP而不是命名管道。在数据源的末尾是要使用的端口。 1433是SQL Server的默认端口。阅读更多此处 [ ^ ]

DBMSSOCN=TCP/IP is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server. Read more here[^]





更多:

如何:配置要侦听的服务器备用管道(SQL Server配置管理器) [ ^ ]

如何:配置服务器以侦听特定TCP端口(SQL Server配置管理器) [ ^ ]

如何:配置Windows Firew全部用于数据库引擎访问 [ ^ ]



More:
How to: Configure a Server to Listen on an Alternate Pipe (SQL Server Configuration Manager)[^]
How to: Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)[^]
How to: Configure a Windows Firewall for Database Engine Access[^]


这篇关于在主机服务器上获取错误。购物车在本地机器上成功运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆