我正在使用REST和SOAP端點創建WCF4服務,並將其託管在IIS 7.5中。 我已經使用WCF4 REST模板作爲示例。 但是我有幾個關於我的設置的問題。如何使用REST/SOAP端點發布WSDL以用於WCF 4.0服務
這裏是我的webconfig
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<behaviors>
<endpointBehaviors>
<behavior name="REST">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MEXGET">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MEXGET" name="Project.WebService.VehicleService">
<endpoint
address=""
behaviorConfiguration="REST"
binding="webHttpBinding"
contract="Project.WebService.IVehicleService" />
<endpoint
address="soap"
binding="basicHttpBinding"
contract="Project.WebService.IVehicleService" />
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
我已刪除了standardEndpoints部分並添加自己的端點。因爲我已經設置在Global.asax路線 沒有.SVC文件如下圖所示
private void RegisterRoutes()
{
RouteTable.Routes.Add(new ServiceRoute("VehicleService", new WebServiceHostFactory(), typeof(VehicleService)));
}
幫助頁面可以訪問通過http://localhost:1313/ServiceTest/VehicleService/help
我還使用WCF測試客戶端訪問http://localhost:1313/ServiceTest/VehicleService/mex 其中顯示SOAP端點的元數據
但是,如何檢索服務的WSDL?
使用svc文件我可以在http://localhost:1313/ServiceTest/VehicleService.svc?wsdl找到wsdl但是我沒有.svc文件。 而且,無論我可以找到http://localhost:1313/ServiceTest/VehicleService?wsdl或http://localhost:1313/ServiceTest/VehicleService/soap?wsdl
的WSDL我是否需要添加一個.svc文件,如果我要發佈WSDL的SOAP終點?