如何在IIS上部署WCF服务应用程序

时间:2013-09-13 05:52:03

标签: c# wcf

我是WCF服务的新手。我已经创建了一个服务应用程序并将应用程序代码目录放在IIS的默认网站下。它与我的客户端连接得非常好。

我想知道如何在IIS上将我的服务部署为二进制文件,截至目前,我的整个源代码在服务器上可见

3 个答案:

答案 0 :(得分:8)

它被称为WCF服务发布

检查MSDN Documentation

发布后,服务器中只有汇编文件,Web.config文件和.svc 文件

答案 1 :(得分:6)

1:从VS发布您的wcf服务应用程序并提供发布路径。

2:在IIS中创建一个指向发布目录的虚拟目录

3:将虚拟目录默认页面设置为应用程序的.SVC文件。

然后尝试浏览它..我希望你现在可以做到..

答案 2 :(得分:2)

Courtesy : http://social.msdn.microsoft.com/Forums/vstudio/en-US/5c0a54e7-af4b-422f-bf5d-5f2f93d46ed0/deploying-wcf-service-to-iis-75


#i), You need create a new application on IIS for your wcf application.
#ii), To configure the service use specific port as nettcp endpoint port on IIS, you need edit "Bindings..." section on "Default Web Site", change the "net.tcp" type binding to use your desired port, (for example, to use 22550, set Binding information to "22550:*")
#iii), You can just set nettcp endpoint address with relative uri. IIS will transform the address to absolute url automaticly.
#iv-v), To enable nettcp protocol on IIS application, you could open "Advanced Settings" on specific IIS application, edit "Enabled Protocols" pair, add "net.tcp".
#vi), Yes, add a MEX endpoint, and add serviceMetadata to ServiceBehavior. See this configuration sample:

  <system.serviceModel>
    <services>
      <service name="nettcp_wcf.Service1" behaviorConfiguration="nettcp_wcf.Service1Behavior">
        <!--use relative url-->
        <endpoint address="nettcp" binding="netTcpBinding" contract="nettcp_wcf.IService1">
        </endpoint>
        <!--add mex endpoint-->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="nettcp_wcf.Service1Behavior">
          <!--enable metadata service-->
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

Here is an article about configure iis to host nettcp wcf, please have a look
http://blogs.msdn.com/swiss_dpe_team/archive/2008/02/08/iis-7-support-for-non-http-protocols.aspx