0

我是使用 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”,但没有运气。

提前感谢您的帮助!

4

1 回答 1

1

经过更多的挖掘,我得到了它的工作。我不得不这样做:

  1. 以管理员身份运行 Visual Studio 命令行。
  2. 转到 C:\Windows\Microsoft .NET\Frameword v3.0\Windows Communication Foundation
  3. 运行“servicemodelreg -i”

这将安装查看服务所需的所有东西。

于 2010-04-13T18:08:35.740 回答