困惑“找不到或无法访问服务器。”错误,但仅适用于某些用户

时间:2018-07-27 16:22:58

标签: .net iis model-view-controller

我正在尝试找出IIS Web应用程序中的问题。从表面上看,这似乎是一个简单的安全问题,但事实并非如此。

大约一年前,上一次我必须对其进行更改时,它一直在工作。我这次所做的更改很小,但是当我部署到开发服务器时,我开始出现以下错误:

 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)

似乎很简单。显而易见的答案是,去年发生了一些变化,现在找不到数据库服务器。问题出在这里:尝试访问该网站时出现错误,但是其他人却没有。除了连接字符串使用特定的用户ID和密码来访问数据库外,看起来仍然像是一个简单的权限问题。已经参与该项目多年的企业所有者都无法进入。去年加入团队的业务分析师可以加入。我上个月创建的测试用户可以加入。

该应用程序连接到两个单独的数据库。两个连接使用相同的用户和密码。我在服务器上安装了SSMS,并且能够以我本人和用户身份通过​​连接字符串连接到两个数据库。

我遍历了wwwroot下应用程序文件夹中的权限,并且我拥有完整权限。 ApplicationPool已分配了特定的用户。该用户还拥有文件​​夹的完整权限。我是VM的管理员,但企业所有者还不能再是VM管理员的其他人进入该站点,而不会出现错误。

.Net Framework 4.5 MVC Web应用程序部署在Win Server 2012 R2 VM上的IIS 8.5.96下。

Web.Config -------------------------------------------- ---------

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
       <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0,  Culture=neutral, PublicKeyToken=B77A5C561934E089" />


    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->

</configSections>

  <connectionStrings>
    <add connectionString="metadata=res://*/xxxx.csdl|res://*/xxxx.ssdl|res://*/xxx.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=xxxx;initial catalog=xxxx;User Id=xxx;Password=xxx;MultipleActiveResultSets=True;App=EntityFramework&quot;" name="Entities" providerName="System.Data.EntityClient" />
    <add connectionString="metadata=res://*/xxxx.csdl|res://*/xxxx.ssdl|res://*/xxxx.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=xxx;initial catalog=xxx;User Id=xxx;Password=xxx;MultipleActiveResultSets=True;App=EntityFramework&quot;" name="xxxxEntities" providerName="System.Data.EntityClient" />
  </connectionStrings>


  <system.web>
    <compilation targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="100240" executionTimeout="1200" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="Kendo.Mvc.UI" />
      </namespaces>
    </pages>
<authorization>
        <deny users="?" />
      </authorization>
      <authentication mode="Windows" />
      <customErrors mode="Off" />   
  </system.web>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
<system.webServer>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <remove name="WebDAV" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <modules>
        <remove name="WebDAVModule" />
        <add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral,   PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
        <add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral,   PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
    </modules>

    <rewrite>
      <rules>
                <clear />
                <rule name="http to https" enabled="false" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
                </rule>
                <rule name="Angularjs Conditions" stopProcessing="true">
                    <match url="(vendor/.*|src/.*|api/.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="None" />
                </rule>
            <rule name="Imported Rule 127" enabled="true" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="true" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^xxx\.com$" />
                    </conditions>
                    <action type="Redirect" url="https://xxxx/{R:1}" redirectType="Permanent" />
                </rule> 
      </rules>
    </rewrite>
    <validation validateIntegratedModeConfiguration="false" />
        <httpErrors>
            <remove statusCode="403" subStatusCode="-1" />
           <error statusCode="403" prefixLanguageFilePath="" path="https://xxxx/" responseMode="Redirect" /> 
        </httpErrors>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="3000000000" />
            </requestFiltering>
        </security>
        <httpProtocol>
            <customHeaders>
            <clear />
                <add name="X-UA-Compatible" value="IE=edge" />
            </customHeaders>
        </httpProtocol>

  </system.webServer>

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="secureBinding">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>

<system.identityModel>
    <identityConfiguration>
      <audienceUris>
        <add value="everyone.*" />
      </audienceUris>
      <certificateValidation certificateValidationMode="None" />
      <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <trustedIssuers>
          <add thumbprint="xxx" name="Okta" />
        </trustedIssuers>
      </issuerNameRegistry>
    </identityConfiguration>
  </system.identityModel>

  <system.identityModel.services>
    <federationConfiguration>

      <wsFederation passiveRedirectEnabled="true" issuer="xxx" realm="xxxx" />

      <cookieHandler requireSsl="false" path="/" />
    </federationConfiguration>
  </system.identityModel.services>

</configuration>

0 个答案:

没有答案