0

Hello I have a WCF service library project and I have created a WPF app to host it for testing and that works just fine, but I also created a web app to host it in IIS for production and when I try to connect to the IIs one I never can.

I am using a net.tcp bininding and I have gone in to IIS and added the net.tcp biniding to the web app and the web site.

Basically this is a duplex service with the methods marked as one way. When I call the method in the client the callback never gets called and I end up just sitting there waiting for several minutes before I close the application. When I self host the service I get a response almost immediately on the callback.

Also I have tried using localhost:808 and just localhost. If I use svcutil to generate the config it leaves the port off of the address. I don't get any errors that I am aware of, but I honestly don't really know how to tell if I get any errors it throws from IIS.

Also if I go to http://localhost:9595/EcuWebService/Service.svc I get the page that tells me to use svcutil to generate my client proxy.

As Jocke suggested below I attached a debugger and received this error: The service '/EcuWebService/service' does not exist.

Also here is the contents of my svc file:

<%@ ServiceHost Language="C#" Debug="true" Service="EcuWeb.ServiceLib.Contracts.EcuWebServiceMain" %>

below is my Web.config:

<?xml version="1.0"?>
  <configuration>
<configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
  <appSettings>
     <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
 <system.web>
   <compilation debug="true" targetFramework="4.5" />
   <httpRuntime targetFramework="4.5"/>
 </system.web>
<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="1" multipleSiteBindingsEnabled="true"/>
    <services>
        <service name="EcuWeb.ServiceLib.Contracts.EcuWebServiceMain">
            <endpoint address="net.tcp://localhost:808/EcuWebService/service" binding="netTcpBinding" bindingConfiguration="" name="netTcp_EcuWebServiceEndpoint" contract="EcuWeb.ServiceLib.Contracts.IEcuWebServiceMain">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="net.tcp://localhost:808/EcuWebService/mex" binding="mexTcpBinding" bindingConfiguration="" name="mexTcp_EcuWebServiceEndpoint" contract="IMetadataExchange" />
            <host>
               <baseAddresses>
                  <add baseAddress="http://localhost/EcuWebService" />
                </baseAddresses>
            </host>
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="">
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
</system.serviceModel>

This is the config for the client app. The commented out endpoint is the endpoint that I use when not hosting in IIS and it works.

<?xml version="1.0" encoding="utf-8" ?>
  <configuration>
    <system.web>
      <compilation debug="true" />
    </system.web>
     <!-- When deploying the service library project, the content of the config file    must be added to the host's 
          app.config file. System.Configuration does not support config files for libraries. -->
     <system.serviceModel>
       <bindings>
        <netTcpBinding>
          <binding name="netTcp_EcuWebServiceEndpoint" />
        </netTcpBinding>
       </bindings>
     <client>
      <!--<endpoint address="net.tcp://localhost:5555/EcuWebService/service"
       binding="netTcpBinding" bindingConfiguration="netTcp_EcuWebServiceEndpoint"
       contract="EcuWebService.IEcuWebServiceMain" name="netTcp_EcuWebServiceEndpoint">
        <identity>
         <dns value="localhost" />
        </identity>
       </endpoint>-->
         <endpoint address="net.tcp://localhost/EcuWebService/service"
            binding="netTcpBinding" bindingConfiguration="netTcp_EcuWebServiceEndpoint"
            contract="EcuWebService.IEcuWebServiceMain"    name="netTcp_EcuWebServiceEndpoint">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>
</client>
<services>
  <service name="Ecu.Service.Contracts.EcuServiceMain">
    <endpoint address="service" binding="netNamedPipeBinding" bindingConfiguration=""
      name="netNamedPipe_EcuClientEndpoint" contract="Ecu.Service.Contracts.IEcuServiceMain">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration=""
      name="mexNamedPipe_EcuClientEndpoint" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.pipe://localhost/EcuServiceClient" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
   <serviceBehaviors>
     <behavior name="">
       <serviceMetadata httpGetEnabled="false" />
         <serviceDebug includeExceptionDetailInFaults="true" />
     </behavior>
   </serviceBehaviors>
 </behaviors>

2 Answers 2

1

Ok I finally got this figured out.

First I had to add:

<host>
 <baseAddresses>
  <add baseAddress="net.tcp://localhost:5555/EcuWebService" />
  <add baseAddress="http://localhost/EcuWebService" />
 </baseAddresses>
</host>

Then for the endpoint I just used:

<service name="EcuWeb.ServiceLib.Contracts.EcuWebServiceMain">
<endpoint address="service" binding="netTcpBinding" bindingConfiguration=""
 name="netTcp_EcuWebServiceEndpoint" contract="EcuWeb.ServiceLib.Contracts.IEcuWebServiceMain">
 <identity>
  <dns value="localhost" />
 </identity>
</endpoint>

Then in the client I had to use:

<endpoint address="net.tcp://localhost/EcuWebService/Service.svc/service"
    binding="netTcpBinding" bindingConfiguration="netTcp_EcuWebServiceEndpoint"
    contract="EcuWebService.IEcuWebServiceMain" name="netTcp_EcuWebServiceEndpoint">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>

When I added the port it didn't work, but once I removed it it worked no problem. Also I doubt the base address is required as IIS is giving the address anyway.

0

What happens? Do you get an exception? Can you browse it in the IIS?

Your service has:

endpoint address="net.tcp://localhost:808/EcuWebService/mex"

and the client:

endpoint address="net.tcp://localhost/EcuWebService/service"

I think you need provide more details to get a good answer.

3
  • I added more info, but I don't get any error in the client and yes I can browse to the http address in a browser without any problems, but I don't have any http endpoints defined for communication.
    – twreid
    Feb 12, 2013 at 22:01
  • Try to enable debugging in the IIS/WAS and see if you can get some more information, have you looked in the event log on the machine?
    – Jocke
    Feb 13, 2013 at 8:50
  • Ok I attached a debugger and got The service '/EcuWebService/service' does not exist.
    – twreid
    Feb 13, 2013 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.