Thursday, June 18, 2009

WCF on Multi Host Servers

I ran into this problem today when I was working on a WCF project.  A project which was working fine on my machine start producing the error “This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. Parameter name: item

image

Turns out that because the server was hosting a number of different sites using different Host Headers WCF needs to know which of the hosts to respond too.  You can do this by added the following to the services web.config file.

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
    <baseAddressPrefixFilters>
        <add prefix="http://www.blahblah.com"/>
    </baseAddressPrefixFilters>
    </serviceHostingEnvironment>

        ……

   </system.serviceModel>

 

That tells the service to only respond on the specific header.

Wednesday, June 17, 2009

Self signing your server for SSL

I’ve been playing around with WCF and one of the problem areas is that our secure servers use a reverse-proxy configuration to route requests for web services.  This is all fine for old web services; however WCF is a little more particular with it’s requirements.  The reason for this is that the SSL Certificate does not actually exist on the Secure Server, it exists on the Proxy server, therefore when WCF starts it brings up the error saying “SSL is not supported”.  To resolve this we need to provide the server with a mock certificate using the same domain name as that used by the Proxy server.

To create a local mock SSL certificate for your development machine is quite easy and is also very useful to have if you are doing testing.

Installation

  1. Download the Internet Information Services (IIS) 6.0 Resource Kit Tools from the Microsoft site.
  2. Run the installation  image

         image

3.  Choose a complete install and follow all the instructions until it’s finished.

4.  Now you go to your Start/Programs/IIS Resources/SelfSSL/SelfSSL.

      image

5.   You need to work out your Site ID and the easiest way to get this is to use IIS Admin right click the website properties and go to Logging properties in the website Tab and look at the Log File name below the Site ID is “1”.

       image

6.   Enter the command “SELFSSL.EXE /S:1” and confirm “Y”.

      image

7.   Your site is now activated to use SSL.

     image

Monday, June 8, 2009

SharePoint Site Templates

I was recently asked to change the basic template used when creating a site for the first time from a Blank Site to Team Site.  As the site was created using a PowerShell script it required finding out which code should be used for the sitetemplate option in the STSADM command.

# Create new WebSite
stsadm.exe -o createsite -url $spwebsite -title "My Team Site" -ownerlogin entirl\$username -owneremail sharepointadmin@enterprise-ireland.com -sitetemplate STS#1

Friendly Name Template
Team Site STS#0
Blank Site STS#1
Document Workspace STS#2
Wiki Site WIKI#0
Blog BLOG#0
Basic Meeting Workspace MPS#0
Blank Meeting Workspace MPS#1
Decision Meeting Workspace MPS#2
Social Meeting Workspace MPS#3
Multipage Meeting Workspace MPS#4
Document Center BDR#0
Records Center OFFILE#1
Personalization Site SPSMSITE#0
Site Directory SPSITES#0
Report Center SPREPORTCENTER#0
Search Center with Tabs SRCHCEN#0
Search Center SRCHCENTERLITE#0
Publishing Site CMSPUBLISHING#0
Publishing Site with Workflow BLANKINTERNET#2
News Site SPSNHOME#0

Saturday, June 6, 2009

Set of very interesting Webcasts

I was doing some surfing over the weekend and came across an very interesting site called Dime Casts.  It’s a selection of tutorials that don’t take longer than 10 minutes.

Some of the topics covered are very interesting in terms of good .Net programming techniques for using Design Patterns.  Check it out if you have a few minutes.

Tuesday, June 2, 2009

Set of very interesting Webcasts

I was doing some surfing over the weekend and came across an very interesting site called Dime Casts.  It’s a selection of tutorials that don’t take longer than 10 minutes.

Some of the topics covered are very interesting in terms of good .Net programming techniques for using Design Patterns.  Check it out if you have a few minutes.