Cassini 为同一服务提供多个 WCF 端点
我正在尝试为 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。谢谢。
I'm trying to config a WCF service for Silverlight to use either http or https and it works fine with IIS, but not the web server built into Visual Studio (Cassini). The services section of web.config system.serviceModel is:
<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>
If I remove the 2nd endpoint, all works fine with Cassini. I can easily adjust the service url specified by the client if need be when I detect "localhost". I already adjust the svc url to be http or https based on the silverlight app url. This works great with IIS, but not Cassini. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Visual Studio 内置的 Web 服务器 (Cassini) 不支持 SSL:
ASP.NET 开发服务器(又名 Cassini)支持 SSL 吗?
IIS Express(测试版)很快就会推出,确实如此。
The Visual Studio built in web-server (Cassini) doesn't support SSL:
Does the ASP.NET Development Server (a.k.a. Cassini) support SSL?
IIS Express (beta) is coming pretty soon though, which does.
从技术上讲,您可以通过 VS.NET 调试器 (Cassini) 完成这项工作,但您必须做一些事情。
将步骤 #1 中创建的自签名 SSL 证书应用到端口 8020(或您选择使用的任何端口),如下所示:如何:使用 SSL 证书配置端口
通过 VS.NET 运行服务。如果您使用 WCF 测试客户端工具,那么您将看到通过 Https 公开的本地托管的 WCF 服务。
You can technically make this work via the VS.NET debugger (Cassini), but you will have to do a few things.
Apply the self signed SSL cert made in Step #1 to port 8020 (or whatever port you choose to use) as shown here: How to: Configure a Port with an SSL Certificate
Run the service via VS.NET. If you are using the WCF Test Client tool, then you will see your locally hosted WCF service exposed via Https.