0

I have a WCF service with net.tcp and http server bindings.

Web.config file looks like this

 <system.web>
    <compilation debug="false" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="tcp_Unsecured" portSharingEnabled="true">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
    <services>
      <service name="MarketFeedServiceLibrary.Service1">
        <endpoint address="net.tcp://localhost:808/MarketFeedService/Service.svc/mexTcp"
          binding="mexTcpBinding" bindingConfiguration="" name="mexEndPoint"
          contract="IMetadataExchange" />
        <endpoint address="net.tcp://localhost:808/MarketFeedService/Service.svc/tcpService"
          binding="netTcpBinding" bindingConfiguration="tcp_Unsecured"
          name="dataEndPoint" contract="MarketFeedServiceLibrary.IService1" />
        <endpoint address="http://localhost:80/MarketFeedService/Service.svc/basicHttp"
          binding="basicHttpBinding" bindingConfiguration="" name="httpDataEndpoint"
          contract="MarketFeedServiceLibrary.IService1" />
        <endpoint address="http://localhost:80/MarketFeedService/Service.svc/mex"
          binding="mexHttpBinding" bindingConfiguration="" name="httpMexEndpoint"
          contract="MarketFeedServiceLibrary.IService1" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
       />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

I have hosted the service in IIS in local PC, if I browse in IE using the address "http://localhost/MarketFeedService/Service.svc", I get metadata info as below

Browsing on Local-PC

But if I host the same WCF Web Service in IIS on VPS Server (Windows Server 2008 IIS 7.5), with same address, I get following error,

Browsing on VPS

Also I can add Service Reference of Local Hosted Service, but if I try to add Service Reference of Server with path "net.tcp://IPAddress/MarketFeedService/Service.svc", I get following error

The message could not be dispatched because the service at the endpoint address 'net.tcp://IPAddress/MarketFeedService/Service.svc' is unavailable for the protocol of the address.

N.B.

  1. Net.Tcp Port Sharing Service, Net.Tcp Listener Adapter are turned ON
  2. WCF Http and Non-Http Activation are installed and enabled.
  3. http and net.tcp protocols are enabled for Default Web Site as well as for the application.

Thank you very much in advance.

Marshal
  • 6,551
  • 13
  • 55
  • 91

2 Answers2

0

Is svc file type correctly mapped in IIS? http://msdn.microsoft.com/en-us/library/vstudio/ms752252(v=vs.90).aspx

Jocke
  • 2,189
  • 1
  • 16
  • 24
  • Yes I went through the link, all the settings are done as per that – Marshal Feb 13 '13 at 12:38
  • OK, so you have run: aspnet_regiis.exe -i for .NET 4.0? Is it the full web.config you have posted above? What Managed Pipeline Mode are you running the application in the IIS? Using any http modules or extensions? http://stackoverflow.com/questions/1808680/web-application-problems-web-config-errors-http-500-19-with-iis7-5-and-asp-net – Jocke Feb 13 '13 at 13:03
  • I ran aspnet_regiis.exe but it has [this error](http://serverfault.com/questions/107134/when-i-run-aspnet-regiis-exe-it-just-shows-me-the-command-line-options-and-does), but I went through Handler Mappings of Default Website, it shows *.svc is mapped to aspnet. – Marshal Feb 13 '13 at 13:28
  • Managed Pipeline Mode is Integrated. I am going through [this article](http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/e5b30d8b-beec-4ce3-86ee-dc49b715b97d/) which is related to my error. – Marshal Feb 13 '13 at 13:29
0

Just another option (I can't view the posted snapshots at work because of firewall) for those having issues that may or may not exactly match this one -

I was having a lot of problems, especially with RESTful services that worked okay locally, but crashed and burned on the server. I thought it might be because of conflicting configurations with the root config, or registry, but that was not actually the case.

You have to go into IIS and look at your base site-level setup, there will be a features option called "ISAPI filters."

To make a long story shorter, the specific ISAPI filter called UrlScan (versions may very, I think the current one is 3.1) was the source of our problem. What this filter does is it looks for patterns on incoming requests to try and screen out potentially malicious requests.

As technology changes and improves, requests that are not familiar to the setup come in and are rejected or re-routed. In my case, it was looking at the file extensions. The older SOAP technology launched from an ASP extension was recognized/blessed (.asmx), but we had never set up a RESTful or WCF service, so it didn't recognize the ".svc" extension.

The initial setup is usually so tight that any http request is rejected or re-routed, and whomever is managing the web server tweaks the file to allow for functionality as needed.

You can go to the file location and in the same directory is the .ini file with the settings for that tool.

In that text file, look for the sections called [AllowExtensions] and [DenyExtensions]. Make sure to add .svc to the "allow" group and make sure it isn't explicitly listed in the deny one.

Microsoft - HowTo: Use URLScan

PoloHoleSet
  • 157
  • 1
  • 1
  • 10