Cassini 为同一服务提供多个 WCF 端点

发布于 2024-09-10 16:28:33 字数 1036 浏览 0 评论 0原文

我正在尝试为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我偏爱纯白色 2024-09-17 16:28:33

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.

盗心人 2024-09-17 16:28:33

从技术上讲,您可以通过 VS.NET 调试器 (Cassini) 完成这项工作,但您必须做一些事情。

  1. 通过命令行工具或 IIS 使用您的计算机全名(即 mymachinename)生成自签名测试证书。
  2. 将基地址添加到使用您的计算机名而不是“localhost”dns 的 WCF 配置中。因此 https://mymachinename:8020/Services/MyWCFTest 可能是基地址。
  3. 将步骤 #1 中创建的自签名 SSL 证书应用到端口 8020(或您选择使用的任何端口),如下所示:如何:使用 SSL 证书配置端口

  4. 通过 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.

  1. Generate a self-signed test certificate via the command line tool or IIS with the full name of your machine (i.e. mymachinename).
  2. Add a base address to your WCF configuration that used your macinename rather than the "localhost" dns. So https://mymachinename:8020/Services/MyWCFTest might be the base address.
  3. 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

  4. 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文