简体   繁体   English

在IIS Express ssl上托管的WCF已启用

[英]WCF hosted on IIS express ssl enabled

I've been banging my head for a week now, I am trying to run a WCF service on IIS express and do a GET from the browser, everything works fine in HTTP, but the minute I try the HTTPS it fails with 我已经敲了一个星期,我正在尝试在IIS express上运行WCF服务并从浏览器执行GET ,在HTTP中一切正常,但是尝试使用HTTPS失败的那一分钟

HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

I have tried every single config file in stackoverflow answers I also tried this I know it is for IIS but I can't see why it is not working On IIS express. 我已经尝试了stackoverflow答案中的每个配置文件,但我也尝试过这样做,我知道它是针对IIS的,但是我看不到为什么它在IIS express上不起作用。 here my config file: 这是我的配置文件:

<?xml version="1.0"?>
<configuration>


  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>


  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <behaviors>
      <endpointBehaviors>

        <behavior name="webHttpEnablingBehaviour">

          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>

        <behavior name="webHttpEnablingBehaviour">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>

      </serviceBehaviors>
    </behaviors>
    <services>
      <service
        name="ElasticSearchAPI.GetElasticService" behaviorConfiguration="webHttpEnablingBehaviour">
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />

        <endpoint address=""
          binding="webHttpBinding"
          bindingConfiguration="default"
          contract="ElasticSearchAPI.IGetElasticService"
          behaviorConfiguration="webHttpEnablingBehaviour">
        </endpoint>
        <endpoint address="other"
          binding="basicHttpBinding"
          bindingConfiguration="default"
          contract="ElasticSearchAPI.IGetElasticService">
        </endpoint>
      </service>

    </services>
    <client />
    <bindings>
      <webHttpBinding>
        <binding name="default" ></binding>
      </webHttpBinding>
      <basicHttpBinding>
        <binding name="default" allowCookies="true"></binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <validation validateIntegratedModeConfiguration="false"/>
    <!--
        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"/>

    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
      </customHeaders>
    </httpProtocol>

  </system.webServer>

</configuration>

I am sure I am missing something really silly, but I am really out of ideas, your help is much appreciated. 我确信我确实缺少一些愚蠢的东西,但是我真的没有想法,非常感谢您的帮助。

Update 更新

I can get to my .svc with https but when i try a get from a browser or post from fiddler nothing is working 我可以通过https进入我的.svc,但是当我尝试从浏览器获取信息或从fiddler发布信息时,却无济于事

Use ServiceBehaviour like below- 如下使用ServiceBehaviour-

<serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
</behavior>

This may help you. 这可能对您有帮助。

In WCF Service Config file add following : 在WCF服务配置文件中,添加以下内容:

<binding name="secureHttpBinding">
 <security mode="Transport">
  <transport clientCredentialType="None" />
 </security>
</binding>

In client application config file add following : 在客户端应用程序配置文件中添加以下内容:

<httpProtocol>
 <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
 </customHeaders>
</httpProtocol>

This will allow you to host and access WCF service with HTTPS protocol. 这将允许您使用HTTPS协议托管和访问WCF服务。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM