我正在尝试为 Silverlight 配置 WCF 服务以使用 http 或 https 并且它适用于 IIS,但不适用于 Visual Studio (Cassini) 中内置的 Web 服务器。web.config system.serviceModel 的服务部分是:
<services>
<service behaviorConfiguration="RhymeDotBehavior" name="RhymeDot.Service.Root">
<endpoint name="RhymeDotHttp" address="" binding="basicHttpBinding"
bindingConfiguration="RhymeDotBinding" contract="RhymeDot.IRootService"/>
<endpoint name="RhymeDotHttps" address="" binding="basicHttpBinding"
bindingConfiguration="RhymeDotBindingHttps"
contract="RhymeDot.IRootService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
如果我删除第二个端点,卡西尼号一切正常。如果需要,我可以在检测到“localhost”时轻松调整客户端指定的服务 url。我已经根据 silverlight 应用程序 url 将 svc url 调整为 http 或 https。这适用于 IIS,但不适用于 Cassini。谢谢。