How can I host a WCF service without an SVC file in IIS

后端 未结 1 411
失恋的感觉
失恋的感觉 2021-01-18 15:40

I\'d like to deploy a dual interface (SOAP/REST/XML/JSON) WCF service in IIS with just a config file and the binaries and no svc file in the URL

We use VS2012 and .N

相关标签:
1条回答
  • 2021-01-18 15:49

    If you're using WCF 4.0 or later, you can use "file-less" activation. Add something like the following to config your file:

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
      <serviceActivations>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" 
             relativeAddress="Soap.svc" 
             service="Cmp.MySoft.BL.NeOthe.NeOtheWrapper" />
      </serviceActivations>
    </serviceHostingEnvironment>
    

    This allows you to host a WCF service without a physical .svc file. The relativeAddress is relative to the base address of the site, and you'll need to create the IIS application as usual.

    See the "File-Less activation" section in A Developer's Introduction to Windows Communication Foundation 4 for more information.

    0 讨论(0)
提交回复
热议问题