Address error when using iis host wcf Service

Source: Internet
Author: User

It is a good choice to write a service using WCF and then use IIS as the host, but this may encounter some minor problems during actual deployment, as described below.

When debugging the local machine, there is no problem. Pay attention to the access address marked with a red pen in the figure.

However, after deploying it to a real server, we found that the metadata address is not the IP address we expected, but the host name.

In this way, if you directly use this metadata to generate a client to access the Web service, the host name cannot be properly accessed due to host name interpretation failure. You must manually specify the access address for the client.

What should I do if people are unhappy? After a lot of research, I finally found a solution to solve this problem by configuring IIS.

1. Enter the command "inetmgr" on the server to enable IIS configuration.

2. Right-click "default website" and select "properties" in the pop-up menu (assume that your web service is in the default website)

3. Select "advanced" in the "website ID" Area of the "website" tab ",

4. For example, select the entry "Default Value" and click "edit"

5. Enter "10.186.3.21" in "Host Header Value". This is the IP address of my host.

6. OK. It will be done!

Slow! You will find that the problem still exists and remains unchanged at all. What is the problem? I am so sleepy and hard to understand. In fact, to make the website take effect, I have to do one thing:

Click your web. config file to make the web service take effect again!

Web. config does not need to modify any content. You only need to enter a space in it, delete it, and save it. You can see it again:

It is quite difficult to find the answer to a small question.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.