Things I need to remember... IIS Express ports for HTTPS and Configure WCF Rest endpoints for HTTPS

Don't Forget
As I have been writing consistently for a bit now I've already found myself referring back to things I've posted, which has prompted me to try and post items which have taken a bit of time to work out. It seems that the act of "writing it down" causes me to remember information better. Perhaps it's all the thought into attempting to write something useful.

This post includes two details which took me more than a few hours to sort out so I hope to help others who have a similar need. Funny enough it could be me in the future after I've forgotten this information.

First up is a little detail that I know I've forgotten and looked up more than once, and depending on the google/bing results I find sooner or later.

Setting up IIS Express to host a site via HTTPS

When configuring your site to run in IIS Express using Visual Studio it's fairly trivial to set the attribute to use SSL (i.e. HTTP over SSL which is HTTPS) as it's just an "enable" in the drop box for use SSL. Additionally when you do this it will ensure that a local cert is setup as well which should be locally trusted so that the browser doesn't through any warnings; but a detail that could trip you up is you'll need to use a PORT within a specific pre-allocated range as IIS Express grabs the range just for this purposes.

Port range 44300 to 44399

A great troubleshooting at pluralsight that includes this little gem on port ranges along with other tips.

Setup bindings for WCF REST service end-points to use HTTPS be default

I'll be the first to acknowledge that this is really legacy information as WCF REST services have been essentially deprecated by .NET WebAPI technologies, and for that I'm VERY pleased; however, working with legacy technologies has NOT been deprecated so I'll post this here for others benefit.

This nugget of information took me the better part of the morning to dig out of a the Microsoft site on A Developer's Introduction to Windows Communication Foundation 4.

The detail I needed was found under the sub-heading aptly named Default Binding Configurations where it outlines that if you would like a particular binding to be used by default you simply need to create the binding without a name and by this convention all service end-points will, be default utilize this binding. The same is true of a behavior configuration, omit the name property and the binding or behavior is adopted by all services defined in the project.

From the same document they provide the following sample which I've replicated and modified to demonstrate how to enable HTTPS for all your service end-points.


<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding>
<security mode="Transport" />
</binding> </basicHttpBinding> </bindings>
</system.serviceModel>
</configuration>

No comments:

Post a Comment