简体   繁体   English

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

[英]How to deploy WCF service application on IIS

I am new to WCF services.I have made a service application and put the application code directory under default website of IIS.It connects with my client very well. 我是WCF服务的新手。我已经创建了一个服务应用程序并将应用程序代码目录放在IIS的默认网站下。它与我的客户端连接得非常好。

I want to know how to deploy my service on IIS as binary,as of now my whole source code is visible on server 我想知道如何在IIS上将我的服务部署为二进制文件,截至目前,我的整个源代码在服务器上可见

it is called WCF Service Publishing 它被称为WCF服务发布

check the MSDN Documentation 查看MSDN文档

after publishing you have only assembly files, Web.config file, and .svc file in the server 发布后,您只有服务器中的程序集文件,Web.config文件和.svc文件

1 : Publish your wcf service application from VS and give a publish path. 1:从VS发布您的wcf服务应用程序并提供发布路径。

2 : Create a virtual directory in IIS which will point to the publish directory 2:在IIS中创建一个指向发布目录的虚拟目录

3 : Set the virtual directory default page to .SVC file of your application. 3:将虚拟目录默认页面设置为应用程序的.SVC文件。

Then try to browse it ..I hope you will be able to make it now.. 然后尝试浏览它..我希望你现在能够成功..

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM