Archive
Configuring IIS7 to provide correct hostname in WCF WSDL and Service Metadata
I ran into a problem when I started to host WCF services on Server 2008 in that I kept getting the netbios name of the server instead of the service website in the service metadata and WSDL.
I created a website with a unique IP address on my Windows 2008 server with the address of http://IISHostedServices.maltercorp.com and the virtual website to host the service is MaltercorpService. When I browsed on my service, I got the following metadata page:

Bad Metadata
As you can see in the address bar, the correct ip address is used, but the complete URL of the website does not appear. A little further down you can see that the metadata page thinks I am pointing to mmant2 which is the netbios name of the server. It’s address is 10.1.2.0.
The fix was to edit the binding of the website and to use the same name I used in DNS to point to the site. I want to point out that there are a number of blog entries out there that explain how to fix this problem but they are recommending the use of the IIS utility tool adsutil.vbs, killing the w3wp.exe process and several other steps.
I am adding my solution because it differs in that the IIS UI was used to change the binding. Personally I found it easier to use the UI as shown in the screenshot below. I did not have to do anything additional after adding a hostname:

- Edit Binding in IIS UI
After adding the hostname, which is the same address I configured DNS to point to, I simply restarted the site and when I browsed on the service, this time the correct name of the website appeared on the metadata page. Also notice that in the address bar, instead of the ip address appearing, the actual URL for the web site appears.

Good Metadata
Just as an FYI, in a related post, I am writing a series of articles on a practical WCF architecture. The first post is here.
Categories
- AJAX (3)
- Computer Mutts (1)
- CSS (1)
- Entity Framework (1)
- Forms Authentication (1)
- Hyper-V Links (1)
- IIS (3)
- Microsoft Exchange 2007 (3)
- Networking (1)
- Programming (10)
- Security Links (1)
- SQL Server (1)
- SSL (1)
- Team Foundation Server 2010 (1)
- Visual Studio 2010 (1)
- WCF (6)
Recent Posts
Popular Posts
Archives
- April 2011 (1)
- March 2011 (1)
- December 2009 (3)
- October 2009 (5)
- September 2009 (2)
- August 2009 (3)
- July 2009 (2)
- May 2009 (2)
- April 2009 (5)
ISA Server Links
ORM Links
Miscellaneous Links
Blog Stats
- 42,033 hits
Recent Comments