访问WCF Rest服务(WebGet)时出现错误请求400

时间:2011-01-18 15:19:22

标签: .net wcf rest

我在visual studio 2008上构建了一个WCF REST Web服务(在windows xp上)

当我尝试通过URL访问webservice时,它返回400错误的请求错误。

[WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "hello/{Name}")]
[OperationContract]
string SayHello(string Name);

请帮忙。

的web.config

<system.serviceModel>
    <services>
      <service behaviorConfiguration="DNNServiceBehavior" name="DNNService">
        <endpoint address="" binding="wsHttpBinding" contract="IDNNService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding"  contract="IMetadataExchange" />
        <endpoint address="rest" binding="webHttpBinding" behaviorConfiguration="httpBehavior" contract="IDNNService"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DNNServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="httpBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>

0 个答案:

没有答案