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 si开发者_StackOverflow社区lverlight app url. This works great with IIS, but not Cassini. Thanks.
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.
You can technically make this work via the VS.NET debugger (Cassini), but you will have to do a few things.
- Generate a self-signed test certificate via the command line tool or IIS with the full name of your machine (i.e. mymachinename).
- 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.
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.
精彩评论