404 BadRequest providing WCF service through an external IP address using IIS host headers

We host the WCF web service on Windows Server 2003. This server has only 2 internal IP addresses. We want to expose the service from the outside. This is done through a firewall that displays the external IP address of the service.

So, I will need to change the service to display this external IP for internal links. This is not a problem since it should only be used externally.

Changing the host header value in IIS gives the response "Bad request (invalid host name)" from IIS. I also added the "address" value for the endpoint entry in the web.config file ... but it only points to the internal name of the machine. Any ideas?

edit: I can verify that IIS7 has the same behavior. The address did not work. The other host name contains an invalid host name. Is there no way to present another (fictitious) IP?: /

edit2:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicAnonymous">
                <security mode="None"/>
            </binding>
        </basicHttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="Extended">
                <serviceMetadata httpGetEnabled="true"/>
                <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <diagnostics>
        <messageLogging logEntireMessage="true" logMalformedMessages="false" logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="true" maxMessagesToLog="3000"/>
    </diagnostics>
    <services>
        <service behaviorConfiguration="Extended" name="AnCWCFWebService.ProductInfoProvider">
            <endpoint address="" binding="basicHttpBinding" name="ASMX" bindingConfiguration="BasicAnonymous" contract="AnCWCFWebService.Interfaces.IProductInfoProvider"/>
        </service>
    </services>
</system.serviceModel>
+3
source share
3 answers

404 BadRequest Due to IIS Configuration ...

If you get 404 BadRequest error from IIS after trying to change host headers in IIS, this is common, but there is a fix!

Fix for IIS configuration changes

How can WCF support multiple IIS bindings for each site ?:
http://tinyurl.com/55q5hg

Correction by Changing WCF Code

, , :

, ! WCF, SSL
http://geekswithblogs.net/rakker/archive/2008/07/03/123562.aspx

...

, IIS:

, ...

" IIS wcf "

, GeeksWithBlogs.net, :

, ...


...

WCF , , . - , .

( - ) WCF IIS - - ASMX.

, , WCF, , , , -. "Application Service WCF" ( " " "" # VB).

, , . - -, , , , . - ASMX, , .

ASMX WCF -, , , , , .

URL

SVC ASMX - URL-, . , . , - ASMX, , - , web.config.

URL-...

  • HTTP:.// /WcfService1/Service1 SVC
  • HTTP:.// /WcfService1/Service1 ASMX
  • http:// MachineName MachineFQN/WcfService1/Service1. svc
  • http:// MachineName MachineFQN/WcfService1/Service1. asmx
  • HTTP:.// MachineLocalIP # 1/WcfService1/Service1 SVC
  • HTTP:.// MachineLocalIP # 1/WcfService1/Service1 ASMX
  • HTTP:.// MachineLocalIP # 2/WcfService1/Service1 SVC
  • HTTP:.// MachineLocalIP # 2/WcfService1/Service1 ASMX
  • HTTP:.// ExternalIP/WcfService1/Service1 SVC
  • HTTP:.// ExternalIP/WcfService1/Service1 ASMX

.

, - - ASMX URL-, -. , - ASMX -...

- WCF, - ASMX WcfTestClient.exe, Visual Studio 2008 (C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE).

- > , URL- URL- , . SVC ASMX. , MEX, "httpGetEnabled" <serviceMetadata/> web.config, , , :

http://i.stack.imgur.com/mNK8l.jpg

:

, , WCF, , , , .

WCF, - ASMX , , , web.config .

- , :

, , WCF - ASMX:

+7

IIS, WSDL donmain, .

IIS, WCF WSDL.

+1

Why not just assign a new IP address to the server instead of messing with host names? Windows Server can have multiple IP addresses for the same network adapter.

Here is an article that talks about this.

+1
source

Source: https://habr.com/ru/post/1703290/


All Articles