【问题标题】:Can I have multiple .svc files in one virtual directory under IIS in WCF?我可以在 WCF 的 IIS 下的一个虚拟目录中拥有多个 .svc 文件吗?
【发布时间】:2010-05-21 08:07:01
【问题描述】:

我可以在 WCF 的 IIS 下的一个虚拟目录中拥有多个 .svc 文件吗?如果有怎么办?

【问题讨论】:

    标签: wcf


    【解决方案1】:

    您需要有两个服务合同,并且在web.config 部分中您需要注册这两个服务:

    <system.serviceModel>
        <services>
            <service name="YourNamespace.Service1" 
                     behaviorConfiguration="returnFaults">
                <endpoint 
                    address="" 
                    binding="basicHttpBinding"           
                    contract="Yournamespace.IService1" />
            </service>
            <service name="YourNamespace.Service2" 
                     behaviorConfiguration="returnFaults">
                <endpoint 
                    address="" 
                    binding="basicHttpBinding"           
                    contract="Yournamespace.IService2" />
            </service>
        </services>
    </system.serviceModel>
    

    那么您的每个服务可以有两个 .svc 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-23
      • 1970-01-01
      • 1970-01-01
      • 2020-05-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多