Friday 29 June 2012

Azure WCF Role - url issue

Problem:  Created a WCF service using Visual Studio (VS) 2010, I called my endpoint TimesheetBOL.svc.  This WCF worked perfectly when deployed locally but then I used the Azure emulator or the Azure Service role, the scv endoint was pointing to the local machine and not using the host header.
Here is the issue. I have a simple service that I deployed to Azure. It is accessible via:
http://tspaulbeck.cloudapp.net/TimesheetBOL.svc but the link to the wsdl uses the internal machine name instead of the host header, like this:
svcutil.exe http://rd006123e/TimesheetBOL.svc?wsdl Obviously, the wsdl is not accessible.

WCF test util throws the following error:
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
Server stack trace: at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrNotOpen()

Resolution:  Us an attribute supported in .NET 4, "useRequestHeadersForMetadataAddress".




0 comments:

Post a Comment