首先,我会道歉,因为这可能是重复的,但我读到的所有内容似乎都不完整或令人困惑,因为我对 WCF 很陌生。
我基本上希望在 IIS 中部署一个 WCF 服务,可以访问 2 个端点,并且整天都在绕圈子:(
我有一个具有以下结构的服务库 WCF dll
App.config
TestSvc1.cs
ITestSvc1.cs
TestSvc2.cs
ITestSvc2.cs
这在 VS WCF 测试客户端中运行良好,现在我正在部署到 IIS,所以我创建了一个 WCF 服务应用程序并引用了 dll。该项目具有以下结构
Service1.svc
Web.config
Service1.svc
包含这个
<%@ ServiceHost Language="C#" Debug="true"
Service="WCFServices.TestServices.ITestSvc1" CodeBehind="Service1.svc.cs" %>
我web.config
的有以下
<services>
<service name="WCFServices.TestServices.TestSvc2">
<endpoint
address=""
binding="wsHttpBinding" bindingConfiguration="LargeSizeMessages"
contract="WCFServices.TestServices.ITestSvc2">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/wcf2/TestServices/TestSvc2/" />
</baseAddresses>
</host>
</service>
<service name="WCFServices.TestServices.TestSvc1">
<endpoint
address=""
binding="wsHttpBinding" bindingConfiguration="LargeSizeMessages"
contract="WCFServices.TestServices.ITestSvc1"
listenUri="http://localhost:8080/wcf2/service1.svc">
<identity>
<dns value="" />
</identity>
</endpoint>
<endpoint
address=""
binding="wsHttpBinding" bindingConfiguration="LargeSizeMessages"
contract="WCFServices.TestServices.ITestSvc2"
listenUri="http://localhost:8080/wcf2/service1.svc">
<identity>
<dns value="" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/wcf2/TestServices/TestSvc1/" />
</baseAddresses>
</host>
</service>
</services>
任何帮助将不胜感激。如您所见,我尝试web.config
在Service1.svc
我还阅读了有关创建继承这些接口的类的信息,但我不确定如何根据上面的内容来实现它。我需要修改Service1.svc
吗?
public interface MultipleSvc : ITestSvc1, ITestSvc2
{
// What exactly do I put here? I have no idea, do I leave it blank? This didn't work for me
}
任何帮助将不胜感激,谢谢:)