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

8

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

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

3个回答

8

这被称为WCF服务发布

请查看MSDN文档

发布后,服务器上只有程序集文件、Web.config文件和.svc文件


6

1:从VS中发布你的WCF服务应用程序,并提供一个发布路径。

2:在IIS中创建一个虚拟目录,该目录将指向发布目录。

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

然后尝试浏览它..我希望现在你能够做到这点。


2

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

  1. 首先,在IIS上为您的WCF应用程序创建一个新应用程序。

  2. 要在IIS上使用特定端口作为 nettcp 端点端口配置服务,需要编辑 "Default Web Site" 中的 "Bindings..." 部分,将 "net.tcp" 类型绑定更改为使用所需的端口(例如,使用 22550 端口,则将绑定信息设置为 "22550:*")

  3. 您可以设置相对URI的 nettcp 端点地址。IIS会自动将地址转换为绝对URL。 要在IIS应用程序上启用 nettcp 协议,可以打开特定IIS应用程序上的 "高级设置",编辑 "启用协议" 对,并添加 "net.tcp"。

  4. 是的,添加一个MEX端点,并将 serviceMetadata 添加到 ServiceBehavior。请参见此配置示例:


  <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>
    

这是一篇关于配置IIS来托管nettcp WCF的文章,请看一下:http://blogs.msdn.com/swiss_dpe_team/archive/2008/02/08/iis-7-support-for-non-http-protocols.aspx


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接