Problems encountered in the WCF configuration: how to change the Hostname to an IP address

Source: Internet
Author: User
Recently, this problem occurs: when the customer configures the WCF Service, IIS is used as the HOST, but the customer does not purchase the website, so there is no resolution between the DNS and the IP address, only one IP address can be accessed from the external network, but the configured WCF Service on the server will look like this when it is released:

For example, if the Hostname of the IIS server is "ServerPC" and the IP address is "192.168.100.1", there is a WCF Service "MyService. svc" on port 2009. The expected URL is as follows:

Http: // 192.168.100.1: 2009/MyService. svc to access this WCF Service on the Internet, but the published format is as follows:

Http: // ServerPC: 2009/MyService. in this case, svc cannot access this address on the Internet. The previous solution was to modify the hosts file on the machine of any called client and add a record.

192.168.100.1 ServerPC can also solve this problem. However, if there are many clients, this is definitely not an ideal solution. Maybe the keyword is not found, right, I have never found a solution to this problem on the Internet. Today I found a blog written by my buddy on Google to solve this problem. This is the original article, but it is a snapshot of Google, I don't know why I cannot access the original address. The decommission is to use the VBScript interpreter cscript.exe to execute the script % systemdrive % \ inetpub \ adminscripts \ adsutil. vbs. The following is an example of batch processing:

Cls
Cscript.exe // nologo % systemdrive % \ inetpub \ adminscripts \ adsutil. vbs set W3SVC/your_website_identifier_here/ServerBindings 127.0.0.1: 80: 127.0.0.1
Iisreset
Your_website_identifier_here is the website identifier specified in the IIS settings. (open the IIS manager, click the website node on the left, and click the "identifier" column in the table on the right ), the settings are in the format of ip: port: hostname. To achieve my goal, you only need to set the ip address and hostname as the same. If you encounter the same problem as me, you can use this method to solve it. Of course, the author in the original article has mentioned more details than me.

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.