我是使用 WCF 和 Azure 的新手,但我有一个在 Visual Studio 中调试时可以正常工作的 WCF Web 服务。我将启动项目设置为 Azure,我尝试的任何与服务相关的 URL 都会出现 404 错误。
这是我认为相关的代码:来自 IWebService.cs
[OperationContract]
[WebGet(UriTemplate = "GetData/Xml?value={value}", ResponseFormat=WebMessageFormat.Xml)]
string GetDataXml(string value);
并来自 Web.config:
<system.serviceModel>
<services>
<service name="WebService" behaviorConfiguration="WebServiceBehavior">
<!-- Service Endpoints -->
<endpoint address="" binding="webHttpBinding" contract="IWebService" behaviorConfiguration="WebEndpointBehavior"></endpoint>
<endpoint address="ws" binding="wsHttpBinding" contract="IWebService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WebServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebEndpointBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
我尝试将绑定更改为“basicHttpBinding”,但没有运气。
提前感谢您的帮助!