无法在本地主机上访问带有https的C#REST wcf服务
我正在努力使https rest服务器在localhost上运行,以便使用ms visual studio 2015进行测试。常规http REST Wcf服务器运行正常,但当尝试通过https访问本地主机时,它似乎已关闭(无法访问站点)。我已经阅读了上的说明,试图让它工作,但我觉得我错过了一个关键的步骤。我是否可能缺少一些设置 我假设在WcfService项目属性中启用ssl时处理证书的创建,是否正确 下面是我的Web.config文件:无法在本地主机上访问带有https的C#REST wcf服务,c#,rest,wcf,https,localhost,C#,Rest,Wcf,Https,Localhost,我正在努力使https rest服务器在localhost上运行,以便使用ms visual studio 2015进行测试。常规http REST Wcf服务器运行正常,但当尝试通过https访问本地主机时,它似乎已关闭(无法访问站点)。我已经阅读了上的说明,试图让它工作,但我觉得我错过了一个关键的步骤。我是否可能缺少一些设置 我假设在WcfService项目属性中启用ssl时处理证书的创建,是否正确 下面是我的Web.config文件: 特定于IIS的服务器部署如下所示: 。。。
特定于IIS的服务器部署如下所示:
。。。
…
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
</httpModules>
</system.web>
<system.serviceModel>
<services>
<service name="WcfService.Service1" behaviorConfiguration="WcfService.Service1Behavior" >
<host>
<baseAddresses>
<add baseAddress="https://localhost/" />
</baseAddresses>
</host>
<endpoint address=""
binding="webHttpBinding" bindingConfiguration="webHttpTransportSecurity"
behaviorConfiguration="WcfService.Service1EndpointBehavior"
contract="WcfService.IService1" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webHttpTransportSecurity">
<security mode="Transport" />
</binding>
</webHttpBinding>
<wsHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService.Service1Behavior">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="false" 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="WcfService.Service1EndpointBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<!--
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="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>