0

我使用 VS2012 和 SQL 2008R2 在本地计算机上开发了这个应用程序。我正在尝试将其移至生产服务器。它是带有 2012 SQL Server 的虚拟服务器。我检查了远程连接的所有属性,一切都已启用。应用程序将打开登录屏幕,一旦我输入用户名和密码(这是使用 WSAT 在我的计算机上创建的。现在我收到此错误:建立与 SQL Server 的连接时发生网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。(提供者:SQL 网络接口,错误:25 - 连接字符串无效)这就是我所拥有的网络配置:

<connectionStrings>
    <remove name="LocalSqlServer" />
<add connectionString="Server=\\events;Database=Digital Signage;Integrated Security=true" name="DSConnectionString" />
    <add connectionString="data source=\\events;Integrated Security=SSPI;AttachDBFilename=c:\\DS\aspnetdb.mdf;User Instance=true" name="LocalSqlServer" providerName="System.Data.SqlClient" />

4

1 回答 1

1

Not entirely sure, but some points which may help you troubleshoot:

  • You can use a resource like this to help you generate the appropriate connection string
  • I am not sure that Server=\\events sounds entirely right - you should perhaps replace this with the actual SQL instance name here when deploying remotely (either <machine name> or <machine name>\<instance name> for a named instance)
  • You probably don't need to explicitly state the port which SQL Server is listening on (if it's still the default 1433), but something to keep in mind
  • Do you have anywhere that you explicitly reference the connection string LocalSqlServer in your code? If so, have you changed that to reference the connection string DSConnectionString before building and deploying? (NB. It may be better to just keep the connection string entry but change the value of the connection string to what you need for the SQL 2012 instance, rather than creating a new connection string entry but I'm not sure about your specific use case)
于 2013-04-25T16:24:53.933 回答