Click here to Skip to main content
11,566,092 members (50,343 online)
Click here to Skip to main content

Tagged as

How to replace Machine Name with Domain name in WCF Service wsdl link

, 14 Nov 2010 CPOL 18.6K 17
Rate this:
Please Sign up or sign in to vote.
Today I was developing the application for streaming files on server using WCF. Everything was fine until I deployed application on production server. I found out that WCF was taking machine name instead of IP address or domain name. This accurs when WCF service is hosted on IIS. The links to wsdl use local machine name. The autogenerated page I received when I was navigating to the .svc page said:

svcutil.exe http://[machinename]/FileTransferService.svc

I discovered that it could be done by following steps:

  • Produce the wsdl in the browser and save to file (by hitting .svc?wsdl from browser)
  • Produce the xsd files by hitting url from wsdl (xsd=xsd0, etc), and save to file from browser
  • replace all machine name references from wsdl with domain name (or ip address) and change xsd references and save
  • replace all machine name references from xsd files with domain name (or ip address)
  • make sure to name xsd file with .xsd extension (ie, name0.xsd, name1.xsd, name2.xsd)
  • copy wsdl and xsd file(s) to virtual directory
  • add to your web.config following lines:
<behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceBehavior">
          <serviceMetadata httpGetEnabled="true" externalMetadataLocation="http://IPorDomainName/MyServices/FileTransferService.wsdl"  />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Kanasz Robert
Architect The Staffing Edge & Marwin Cassovia Soft
Slovakia Slovakia
My name is Robert Kanasz and I have been working with ASP.NET, WinForms and C# for several years.
MCSD - Web Applications
MCSE - Data Platform
MCPD - ASP.NET Developer 3.5
- Web Developer 4
MCITP - Database Administrator 2008
- Database Developer 2008
MCSA - SQL Server 2012
MCTS - .NET Framework 3.5, ASP.NET Applications
- SQL Server 2008, Database Development
- SQL Server 2008, Implementation and Maintenance
- .NET Framework 4, Data Access
- .NET Framework 4, Service Communication Applications
- .NET Framework 4, Web Applications
MS - Programming in HTML5 with JavaScript and CSS3 Specialist

Open source projects: DBScripter - Library for scripting SQL Server database objects


Please, do not forget vote

You may also be interested in...

Comments and Discussions

 
GeneralReason for my vote of 5 this will come in useful Pin
jim lahey14-Nov-10 21:48
memberjim lahey14-Nov-10 21:48 
GeneralThanks. It took nearly 2 hours I found the solution for this... Pin
Kanasz Robert13-Nov-10 7:38
mvpKanasz Robert13-Nov-10 7:38 
GeneralReason for my vote of 4 good Pin
chirag.khatsuriya13-Nov-10 7:33
memberchirag.khatsuriya13-Nov-10 7:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150624.2 | Last Updated 15 Nov 2010
Article Copyright 2010 by Kanasz Robert
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid