Configuring a WCF service (Web.config) - HttpsGetE

2019-03-18 18:20发布

I am trying to deploy a Silverlight with WCF Service to a hosting. Basically, I have the same problem as this guy: How to configure WCF services to work through HTTPS without HTTP binding? Except the solutions don't work for me.

//edit: I've been pasting it wrong, but it still doesn't work.

I have tried Ladislav Mrnka's answer - changed this in the Web.config file:

  <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />

The dreaded error still appears when I navigate to the .svc file on the server:

The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the
HttpsGetUrl property is a relative address, but there is no https base address.
Either supply an https base address or set HttpsGetUrl to an absolute address.

2条回答
孤傲高冷的网名
2楼-- · 2019-03-18 19:03

Now it should be all correct, I just changed the httpGetEnabled and httpsGetEnabled in the proper place (it's already in the config file). But I still get the error. Should I perhaps specify the HttpsGetUrl somewhere? Where?

Yes, see here.

Should be:

<behaviors>
 <serviceBehaviors>
  <behavior name="NewBehavior">
    <serviceMetadata httpsGetEnabled="true" 
     httpsGetUrl="https://myComputerName/myEndpoint" />
  </behavior>
 </serviceBehaviors>
</behaviors>
查看更多
祖国的老花朵
3楼-- · 2019-03-18 19:08

In configuration, under behaviour where you have set httpsGetEnabled="true", Set httpsGetUrl="https://UserSystemName/EndPointName" too and problem resolved.

<behaviors>
  <serviceBehaviors>
    <behavior name="mexBehaviour">
      <serviceMetadata httpsGetEnabled="true" httpsGetUrl="https:///UserSystemName/EndPointName"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
查看更多
登录 后发表回答