猿问

WCF 服务未通过 https 从邮递员处命中

在添加 SSL 证书之前,邮递员查询正在命中。但是当我添加 SSL 证书时,邮递员请求不起作用。我附上了邮递员请求的文件,以下是我的 webConfig 文件。它给出错误 400 Not Found。

<?xml version="1.0" encoding="utf-8"?>

    <configuration>

      <configSections>

        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

          <section name="SmartTrack.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

          <section name="CMSWebService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

        </sectionGroup>

      </configSections>

      <connectionStrings>

        <add name="SmartTrack.Properties.Settings.connectionstring" connectionString="Data Source=localhost;Initial Catalog=CommandControl2.3;User ID=sa;Password=smarti123#" />

      </connectionStrings>

      <appSettings>

        <add key="appVersion" value="15" />

        <add key="appCode" value="1.2.3" />

        <add key="appUpdatePriority" value="1" />

      </appSettings>

      <system.web>

        <compilation debug="true" targetFramework="4.0" />

      </system.web>

      <system.serviceModel>

        <bindings />

        <client />

        <serviceHostingEnvironment multipleSiteBindingsEnabled="True" />

        <services>

          <service behaviorConfiguration="Default" name="SmartTrack.CMSWebService">

            <endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" contract="SmartTrack.ISmartTrack" />

            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />



          </service>

        </services>

        <behaviors>

          <endpointBehaviors>

            <behavior name="webBehavior">

              <webHttp helpEnabled="true" />

守候你守候我
浏览 185回答 1
1回答

临摹微笑

您需要配置 https 端点,然后在 IIS 中添加 https 协议并指定 https 证书。https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl这是我的配置文件,其 http /https端点都已配置,希望对您有用。&nbsp; &nbsp; &nbsp; &nbsp;<system.serviceModel>&nbsp; &nbsp; &nbsp; &nbsp; <services><!--http, https are all configurated-->&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <service behaviorConfiguration="mybehavior" name="WcfService1.Service1"> <!--http, https are all configurated-->&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <endpoint address="" binding="webHttpBinding" contract="WcfService1.IService1" behaviorConfiguration="webbev" bindingConfiguration="mybinding"></endpoint>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <endpoint address="" binding="webHttpBinding" contract="WcfService1.IService1" behaviorConfiguration="webbev" bindingConfiguration="com"></endpoint>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"></endpoint>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </service>&nbsp; &nbsp; &nbsp; &nbsp; </services>&nbsp; &nbsp; &nbsp; &nbsp; <bindings>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <webHttpBinding>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <binding name="mybinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" sendTimeout="00:10:00" receiveTimeout="00:10:00">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <security mode="Transport">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <transport clientCredentialType="None"></transport>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </security>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </binding>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <binding name="com">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <security mode="None"></security>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </binding>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </webHttpBinding>&nbsp; &nbsp; &nbsp; &nbsp; </bindings>&nbsp; &nbsp; &nbsp; &nbsp; <behaviors>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <serviceBehaviors>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <behavior name="mybehavior">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <serviceDebug includeExceptionDetailInFaults="false" />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </behavior>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </serviceBehaviors>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <endpointBehaviors>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <behavior name="webbev">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <webHttp />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </behavior>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </endpointBehaviors>&nbsp; &nbsp; &nbsp; &nbsp; </behaviors>&nbsp; &nbsp; &nbsp; &nbsp; <protocolMapping>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <add binding="basicHttpsBinding" scheme="https" />&nbsp; &nbsp; &nbsp; &nbsp; </protocolMapping>&nbsp; &nbsp; &nbsp; &nbsp; <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />&nbsp; &nbsp;</system.serviceModel>结果。 顺便说一句,我需要在 IIS 中配置 https/http 绑定基地址。https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl如果有,请 随时告诉我有什么我可以帮忙的。
随时随地看视频慕课网APP
我要回答