我努力讓我的WCF Web服務輸出一個wsdl文件,目前爲止沒有運氣(它是空的?)。空白/空WSDL文件
SVC文件:
<%@ ServiceHost Language="C#" Debug="true" Service="xxx.WCF.SubsetMID" CodeBehind="SubsetMID.svc.cs"
Factory="System.ServiceModel.Activation.WebServiceHostFactory"
%>
的CS文件:
namespace xxx.WCF
{
[ServiceContract(Namespace = "SubsetMID")]
public interface ISubsetMID
{
[OperationContract]
[WebInvoke(BodyStyle=WebMessageBodyStyle.Wrapped)]
long[] GetMIDs(Guid guid, int subsetID);
}
[DataContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class SubsetMID : ISubsetMID
{
public long[] GetMIDs(Guid guid, int subsetID)
{
[...]
return returnValue;
}
}
}
我的網絡配置文件:
<system.serviceModel>
<services>
<service name="xxx.WCF.SubsetMID">
<endpoint address=""
binding="wsHttpBinding"
contract="xxx.WCF.ISubsetMID" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment
multipleSiteBindingsEnabled="true"
aspNetCompatibilityEnabled="true"
/>
</system.serviceModel>
,當我訪問WSD我沒有得到任何錯誤(http://.../SubsetMID.svc?wsdl
),但它只是一個空白頁。
我真的不知道我的服務是REST。我想要的只是一種發佈它的方法,並且有一個簡單的方法可以在新項目中引用它。哈拉斯,我能在互聯網上閱讀的是關於自我託管的WCF服務,Google甚至將「svc」翻譯成「wcf」,這使得搜索非常困難。 :( – Serge
然後改變你的.svc文件標記以使用'ServiceHostFactory'並移除服務方法中的[WebInvoke]'屬性應該爲你做竅門。 – Tim