"此网站无法进行修复"使用WCF服务重置连接

时间:2017-12-14 10:30:47

标签: c# wcf iis

如果这是错误的区域,请道歉,因此对正确位置的任何建议都会很棒。

症状:

当连接到Vivaldi的WCF服务时(这使用chrome渲染引擎),你得到:

无法访问此网站

  

连接已重置。

     

尝试:

     

检查连接检查

     

代理和运行Windows网络诊断的防火墙

     

ERR_CONNECTION_RESET

或者在Firefox的情况下,您被重定向到搜索引擎以查找域。

1 个答案:

答案 0 :(得分:0)

我花了一段时间,这就是我发现问题的原因。

  1. 安装Windows SDK,这将安装一个非常有用的工具来帮助配置WCF服务的web.config。
  2. 运行" C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v10.0A \ bin \ NETFX 4.7 Tools \ SvcConfigEditor.exe"
  3. 转到文件|新建一个新配置,或文件|打开现有配置文件。
  4. 从服务节点,您可以创建新的/编辑服务
  5. 向下滚动到"诊断"节点并单击"消息记录"并将以下项设置为true:" LogEntireMessage"如果你想知道已知的个人身份信息,那么设置" LogKnownPii"真的
  6. 现在点击"结束跟踪"并设置" ActivityTracing"和#34; MessageFlowTracing"真实。
  7. 右键点击"听众"并为初始数据创建ServiceModelMessageLogginListner和ServiceModelTraceListner,以便将日志写入。
  8. 在Source节点上右键单击并创建一个新源,从下拉列表中选择在步骤#7中创建的lisetner。选择调试级别
  9. 保存更改,重置IIS(只是为了确保IIS选择更改)并按照URL进行操作。
  10. 重现错误后,导航到您在步骤#7中指定的位置,您将找到扩展名为.svclog的文件,这是一个纯文本XML文件,然后在与SvcConfigEditor相同的位置。另一个名为" SvcTraceViewer"这允许您在不分页整个xml文件的情况下查看日志。
  11. 以下是web.config示例:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
      </configSections>
      <!--Start of System Diagnostics-->
      <system.diagnostics>
        <sources>
          <source propagateActivity="true" name="System.ServiceModel" switchValue="Off,ActivityTracing">
            <listeners>
              <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                <filter type="" />
              </add>
              <add name="ServiceModelTraceListener">
                <filter type="" />
              </add>
            </listeners>
          </source>
          <source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing">
            <listeners>
              <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                <filter type="" />
              </add>
              <add name="ServiceModelMessageLoggingListener">
                <filter type="" />
              </add>
            </listeners>
          </source>
        </sources>
        <sharedListeners>
          <add type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="NewListener" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">
            <filter type="" />
          </add>
          <add initializeData="E:\Projects\C#\home-intranet-webservice\HomeIntranetService\Web_messages.svclog"
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
            <filter type="" />
          </add>
          <add initializeData="E:\Projects\C#\home-intranet-webservice\HomeIntranetService\Web_tracelog.svclog"
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
            <filter type="" />
          </add>
        </sharedListeners>
      </system.diagnostics>
      <!--End System Diagnostic Settings-->
      <appSettings>
        <add key="Images" value="E:\Projects\Web\home-intranet-website\img"/>
        <add key="PageFragments" value="E:\Projects\Web\home-intranet-website\PageFragments"/>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
      </appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.6.2"/>
        <httpRuntime targetFramework="4.6.2"/>
      </system.web>
      <system.serviceModel>
        <diagnostics>
          <messageLogging logEntireMessage="true" logKnownPii="true" logMalformedMessages="false"
            logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false" />
          <endToEndTracing propagateActivity="true" activityTracing="true"
            messageFlowTracing="true" />
        </diagnostics>
        <standardEndpoints>
          <webHttpEndpoint>
            <standardEndpoint name="Documentation" helpEnabled="true"/>
          </webHttpEndpoint>
        </standardEndpoints>
        <bindings>
          <webHttpBinding>
            <binding name="webHttpTransportSecurity">
              <security mode="None"/>
            </binding>
          </webHttpBinding>
        </bindings>
        <services>
          <service name="HomeIntranetService.Services.ComputersAndLicences">
            <endpoint address="../ComputersAndLicences.svc" behaviorConfiguration="webBehaviour"
              binding="webHttpBinding" bindingConfiguration="" contract="HomeIntranetService.Interfaces.IComputersAndLicences"
              kind="webHttpEndpoint" endpointConfiguration="Documentation" />
          </service>
        </services>
        <behaviors>      
          <serviceBehaviors>     
            <behavior>
              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="webBehaviour">
              <webHttp/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <protocolMapping>
            <add binding="basicHttpsBinding" scheme="https"/>
        </protocolMapping>    
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <!--
            To browse web app root directory during debugging, set the value below to true.
            Set to false before deployment to avoid disclosing web app folder information.
          -->
        <directoryBrowse enabled="false"/>
    
      </system.webServer>
      <system.data>
        <DbProviderFactories>
          <remove invariant="Oracle.ManagedDataAccess.Client"/>
          <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver"
            type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
        </DbProviderFactories>
      </system.data>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <publisherPolicy apply="no"/>
            <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral"/>
          </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="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>