Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5988107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:54:45+00:00 2026-05-22T22:54:45+00:00

I have created a WCF web service in C# deployed in a Windows Service

  • 0

I have created a WCF web service in C# deployed in a Windows Service EXE which is largely working the way I want. I am using it in a self-hosted manner (not within IIS).

In order to make a WSDL file available to the calling Java webservice, I added ServiceMetadataBehavior to the host creation. i.e:

ServiceHost host = new ServiceHost(typeof(MyService));
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
host.Description.Behaviors.Add(smb);
host.Open();

This all worked fine until I moved my service to another server with a different host name. When I connect to the WSDL (http://prod-server:55000/MyService?wsdl), I see that the host name of the development server is hard coded in the WSDL.

Here is a snippet of the WSDL as seen in a browser:

<wsdl:definitions name="MyService" targetNamespace="http://tempuri.org/">
<wsdl:import namespace="MyProject.ServiceContracts" location="http://dev-server:55000/MyService?wsdl=wsdl0"/>
<wsdl:types/>

I have checked all of the C# code in the project, and the development server name is not hard coded anywhere.

In the App.config file, I have the following defined:

<system.serviceModel>
<services>
  <service name="MyService">
    <endpoint address="http://localhost:55000/MyService" binding="basicHttpBinding"
      bindingConfiguration="" contract="MyProject.ServiceContracts.IMyInterface" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:55000/MyService" />
      </baseAddresses>
    </host>
  </service>
</services>

I would expect that this would result in the localhost machine name being substituted, but it persists as the development box name on which the service was originally created / deployed. Am I mistaken?

I also looked into the possibility of explicitly specifying a path to my WSDL file, but from what I can deduce, this can only be done if hosting the service on IIS.

Lastly and purely out of curiosity, I wonder if an actual WSDL file actually gets created (a physical file on disk I mean) or is it dynamically rendered with each request?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:54:46+00:00Added an answer on May 22, 2026 at 10:54 pm

    It is created dynamically, not every call IIRC, but on first request to the metadata endpoint. I’m not sure why your seeing your DEV server name on the non-DEV machine, but, because you’re specifying localhost only in your endpoint address it’s going to resolve DNS using the primary network address for the server. You may want to consider adding the useRequestHeadersForMetadataAddress behavior to your config so that the DNS with which the service is accessed is actually used instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a WCF Data Service and using it in a web application
I have an upload/download web service that I created with WCF. Im using c
I have created a simple wcf service which used the WCF Service Library template.
I have a Data Service created using WCF that internally uses nHibernate. This WCF
I have created an Ajax enabled WCF web service that contains this simple method:
I have a WCF web service called Palladium that is created as a project
I have a WCF web service that implements a RESTful interface. We're using the
I have created a simple Northwind's Product REST Web Service in WCF at /Northwind/Product
I have created a REST service using WCF for communicating with BLL/DAL from UI.
I have created a new wcf4 web application and added a new wcf service.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.