Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

WCF multiple host header with 'same port' causing error

$
0
0

 have read alot of articles to fix this problem but I am unable to solve it.

Scenario I have a website which has a WCF service and 2 host headers

  1. spin-localhost
  2. spin-localhost.worldwide.co.uk (changed to spin-localhost2)

But with same port 44001 I can access spin-localhost service but cannot access spin-localhost.worldwide.co.uk (now spin-localhost2).

Coding

<system.serviceModel>
   
<behaviors>
     
<serviceBehaviors>
       
<behavior name="Bbc.Ww.SalesProjections.UI.Services.CilsDataReceiveBehavior">
         
<serviceDebug includeExceptionDetailInFaults="true" />
       
</behavior>
     
</serviceBehaviors>
   
</behaviors>
   
<bindings>
     
<basicHttpBinding>
       
<binding name="WindowsAuth" maxReceivedMessageSize="2097152">
         
<security mode="TransportCredentialOnly">
           
<transport clientCredentialType="Windows" />
         
</security>
       
</binding>
     
</basicHttpBinding>
   
</bindings>
   
<services>
     
<service behaviorConfiguration="Bbc.Ww.SalesProjections.UI.Services.CilsDataReceiveBehavior" name="Bbc.Ww.SalesProjections.UI.Services.CilsDataReceive">
       
<endpoint address="http://spin-localhost:44001/Services/CilsDataReceive.svc" binding="basicHttpBinding" name="BasicHttpEndpoint" bindingConfiguration="WindowsAuth" contract="Bbc.Ww.SalesProjections.UI.Services.ICilsDataReceive" />
       
<endpoint address="http://spin-localhost.worldwide.co.uk:44001/Services/CilsDataReceive.svc" binding="basicHttpBinding" name="BasicHttpEndpoint" bindingConfiguration="WindowsAuth" contract="Bbc.Ww.SalesProjections.UI.Services.ICilsDataReceive" />
     
</service>
   
</services>
   
<serviceHostingEnvironment>
     
<baseAddressPrefixFilters>
       
<add prefix="http://spin-localhost:44001" />
     
</baseAddressPrefixFilters>
   
</serviceHostingEnvironment>

 
</system.serviceModel>

the above solution failed I tried with factory

public class CustomHostFactory : ServiceHostFactory
{
    protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
    {
        return new ServiceHost(serviceType, baseAddresses[0]);
    }
}

Edit: I am using /Net 3.5 rather 4.

References http://www.sieena.com/blog/archive/2011/02/01/wcf-service-in-iis-with-multiple-host-headers.aspx

http://blogs.msdn.com/b/rampo/archive/2008/02/11/how-can-wcf-support-multiple-iis-binding-specified-per-site.aspx

http://blogs.msdn.com/b/rampo/archive/2007/06/15/supporting-multiple-iis-bindings-per-site.aspx

http://social.msdn.microsoft.com/forums/en-US/wcf/thread/9e248455-1c4d-4c5c-851c-79d9c1631e21/

And many more....

Update 1: After further testing it seems there is an error with worldwide.bbc.co.uk so i changed the name and binding to spin-localhost2.

<endpoint address="http://spin-localhost2:44001/Services/CilsDataReceive.svc" binding="basicHttpBinding" name="BasicHttpEndpoint" bindingConfiguration="WindowsAuth" contract="Bbc.Ww.SalesProjections.UI.Services.ICilsDataReceive" />

I can access the first service with spin-localhost but spin-localhost2 gives 401, 401 and then 400 (not found). checked it with Fiddler.


Viewing all articles
Browse latest Browse all 27852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>