Search code examples
c#iiswcf-binding

Move web application with WCF library from Visual Studio dev to IIS


I have a web application that contains a WCF library. The web app runs on port 64697, the WCF runs on port 50128. When testing by running thru VS 2010 I am able to go to the localhost:50128/eshop.svc and see the svc page. What do I need to do to publish the project to an IIS dev server? IIS is set up to run WCF as I have put a test service on it and can access the wsdl. I have a eshopServive.svc in the wcf library. The library name is "company.EShop.WCF"

Thanks

Web config snippet

<services>
      <!-- Note: the service name must match the configuration name for the service implementation. -->
      <service name="company.eShop.Wcf.eShopWCFService"
               behaviorConfiguration="MyServiceTypeBehaviors" >
        <endpoint address="" binding="basicHttpBinding"
                  contract="Nad.CheckoutVendor.Interfaces.ICheckoutVendorService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
      </service>
   </services>
 <bindings>
     <basicHttpBinding>
       <binding name="BasicHttpBinding_ICheckoutVendorService" closeTimeout="00:01:00"
         openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
         allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
         maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
           <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
         </security>
       </binding>
     </basicHttpBinding>
   </bindings>

Solution

  • I typically compile the service to a DLL, then GAC it on the server. Make sure your .svc file under IIS references the GAC'd DLL like this:

    <%@ Assembly Name="DLLName, Version=1.1.0.0, Culture=neutral, PublicKeyToken=YOURKEY" %>
    <%@ ServiceHost Service="DLLNAME.CLASSNAME" %>