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:
Cscript.exe // nologo % systemdrive % \ inetpub \ adminscripts \ adsutil. vbs set W3SVC/your_website_identifier_here/ServerBindings 127.0.0.1: 80: 127.0.0.1
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.