0
我想在同一個SVC文件下有兩個契約,並且它不工作。當我在IE中打開SVC文件時,出現錯誤,說'端點錯誤'。 如果我從客戶端調用合同的方法,它不會打到服務。 服務器託管在IIS上。同一端點上的兩個休息式WCF契約(svc文件)
請讓我知道這裏發生了什麼。
也有可能有一個wsHttpBinding和一個webHttpBinding在相同的SVC文件或Web服務?他們將被託管在IIS上。
SVCFile
<%@ ServiceHost Language="C#" Debug="true" Service="S1.ServiceDual6" CodeBehind="ServiceDual6.cs" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>
合同
{
[InspectorBehavior]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ServiceDual6 : IServiceREST, IServiceREST2
{
public string RestInDual_Contract(Message mm)
{
return "";
}
public string RestInDual_Contract2(Message mm)
{
return "";
}
}
}
namespace S1
{
[ServiceContract]
public interface IServiceREST
{
[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
string RestInDual_Contract(Message mm);
}
[ServiceContract]
public interface IServiceREST2
{
[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
string RestInDual_Contract2(Message mm);
}
}
的Web.config
<service name="S1.ServiceDual6" behaviorConfiguration="s1bhrWithHttpEnabled">
<host>
<baseAddresses>
<add baseAddress="http://localhost/S2/Service6.svc"/>
</baseAddresses>
</host>
<endpoint address="" binding="webHttpBinding" contract="S1.IServiceREST" behaviorConfiguration="s1bhr">
</endpoint>
<endpoint address="" binding="webHttpBinding" contract="S1.IServiceREST2" behaviorConfiguration="s1bhr">
</endpoint>
</service>