简体   繁体   English

SQL网络接口,错误:26-错误定位服务器/实例指定不使用SQL Server Express

[英]SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified not using SQL Server Express

There are numerous posts regarding the SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified and I tried the suggested solutions with no success. 关于SQL网络接口,有很多帖子,错误:26-查找指定的服务器/实例时出错,我尝试了建议的解决方案,但均未成功。 I'm migrating an ASP.NET 4 VB web application developed in VS 2010 Windows Server 2008 R2 to a new server Windows 2012 R2 with VS 2012 and a full developer version of SQL Server 2012 installed. 我要将在VS 2010 Windows Server 2008 R2中开发的ASP.NET 4 VB Web应用程序迁移到具有VS 2012并安装了SQL Server 2012完整开发人员版本的新服务器Windows 2012 R2。 The server has IIS installed and the application has been added here as well. 该服务器已安装IIS,并且该应用程序也已添加到此处。 The security permissions have been set up for users IUSR, IIS_IUSRS and even the application pool. 已为用户IUSR,IIS_IUSRS甚至应用程序池设置了安全权限。

My SQL Server 2012 has a named instance which I can connect to using server authentication with no issues and adding the connection string in VS Server Explorer was successful. 我的SQL Server 2012有一个命名实例,我可以使用服务器身份验证毫无问题地连接到该实例,并且可以在VS Server Explorer中成功添加连接字符串。

There 3 other ASP.NET applications working applications on that box which have successfully connected to SQL Server. 该框上还有3个其他ASP.NET应用程序正在运行的应用程序已成功连接到SQL Server。 I have modified my web.config file to emulate the working applications countless times with no success. 我已经修改了我的web.config文件以模拟无数次运行的应用程序,但均未成功。

Based on what I have read, the machine.config file is looking for the LocalSqlServer connection string but adding/removing this in the web config makes no difference. 根据我的阅读,machine.config文件正在寻找LocalSqlServer连接字符串,但是在Web配置中添加/删除该字符串没有什么区别。 The connection string I set up is named "myConn" and I verified the SQL Server name instance is correct, the service is enabled, the SQL Browser is also enabled and the firewall is not even on at this point. 我设置的连接字符串名为“ myConn”,并确认SQL Server名称实例正确,服务已启用,SQL浏览器也已启用并且此时防火墙甚至未打开。 The connectiong string was added by Visual Studio but like I mentioned before; connectiong字符串是由Visual Studio添加的,但是就像我之前提到的那样; it makes no difference if I remove it. 如果我将其删除,则没有任何区别。

Any help will be greatly appreciated. 任何帮助将不胜感激。

Here is my web.config: 这是我的web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="myConn" connectionString="Data Source=MY-SQLServer;Initial Catalog=Sales;Persist Security Info=True;User ID=sa;Password=******; Pooling=true;Connection Lifetime=0; Min Pool Size=2; Max Pool Size=600; Connection Timeout=60" providerName="System.Data.SqlClient" />
    <add connectionString="data source=.\SQLExpress;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=false" name="LocalSqlServer" providerName="System.Data.SqlClient" />

  </connectionStrings>
  <system.web>
    <authentication mode="Forms">
    </authentication>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" />
        <add assembly="Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" />
        <add assembly="Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" />
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
    </compilation>
        <identity impersonate="true" password="*****" userName="Domain\adminUser" />

  </system.web>
  <system.webServer>
    <security>
      <requestFiltering>
        <fileExtensions>
          <add fileExtension=".docx" allowed="true" />
          <add fileExtension=".dotx" allowed="true" />
        </fileExtensions>
      </requestFiltering>
    </security>
  </system.webServer>
</configuration>

Here is a snippet of the Login.aspx.vb code: 这是Login.aspx.vb代码的一个片段:

 Dim cn As New SqlConnection 'SQL Connection
                 cn.ConnectionString = ConfigurationManager.ConnectionStrings("myConn").ConnectionString
                 cn.Open() 'open sql connection
                 Dim cmd As New SqlCommand
                 cmd.CommandType = CommandType.Text
                 cmd.Connection = cn
                 cmd.CommandText = "select count(*) from Sales where email='" & LoginUser.UserName.ToString"
                 Try
                     Dim x As Integer = cmd.ExecuteScalar()
                     If x > 0 Then
                         cn.Close()
                         Session("user") = LoginUser.UserName.ToString()
                         Response.Redirect("~/Default.aspx", False)
                     Else
                         cn.Close()
                         LoginUser.FailureText = "Login error message."
                    End If
                 Catch ex As Exception
                     cn.Close()
                    LoginUser.FailureText = ex.Message & "<br/ >Please try logging in again."
            End Try

You say that you have a named instance of SQL Server Developer Edition but neither of the connection strings you have in that config file indicate that. 您说您有一个SQL Server Developer Edition的命名实例,但是该配置文件中没有任何连接字符串都表明这一点。 If the Data Source in the connection string is set to "SQLS2012" then that means a default instance on a machine with that name. 如果连接字符串中的“ Data Source ”设置为“ SQLS2012”,则表示该名称的计算机上有一个默认实例。 A named instance on the local machine should be ".\\InstanceName", "(local)\\InstanceName" or "MachineName\\InstanceName". 本地计算机上的命名实例应为“。\\ InstanceName”,“(local)\\ InstanceName”或“ MachineName \\ InstanceName”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL服务器错误(提供程序:SQL网络接口,错误:26-错误指定服务器/实例的位置) - SQL SERVER ERROR (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 错误。 SQL网络接口,错误:26-指定服务器/实例时出错 - Error. SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified SQL网络接口,错误:26 - 找到为MDF文件指定的服务器/实例时出错 - SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified for MDF file 在我的VM上:SQL网络接口,错误:26-查找指定的服务器/实例时出错 - on my VM: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified 提供程序:SQL网络接口,错误:26-指定服务器/实例时出错 - provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified SQL网络接口,错误:26-通过asp.net应用程序连接时指定服务器/实例时出错 - SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified while connecting via asp.net application SQL错误26错误定位指定的服务器/实例 - SQL Error 26 Error Locating Server/Instance Specified 仅在调试时才出现SQL Server错误26(指定错误的服务器/实例) - SQL Server Error 26 (Error Locating Server/Instance Specified) Only When Debugging 错误26的解决方案-指定错误的服务器/实例定位? - Solution for Error 26 - Error Locating Server/Instance Specified? ASP.Net错误26错误定位指定的服务器/实例 - ASP.Net Error 26 Error Locating Server/Instance Specified
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM