无法调试REST服务

时间:2013-11-15 08:45:52

标签: c# wcf rest linkedin

以下是该服务的web.config文件中的设置。

 <system.serviceModel>
<services>
  <service behaviorConfiguration="Service1Behaviors" name="ITDService.ITDService">
    <endpoint address="ITDService" binding="webHttpBinding" contract="ITDService.IITDService" kind="webHttpEndpoint"  behaviorConfiguration="webBehavior"/>
</service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="webBehavior">
      <webHttp />
    </behavior>
  </endpointBehaviors>

  <serviceBehaviors>
    <behavior name="Service1Behaviors">
      <serviceMetadata httpGetEnabled="true" />
      <!--<dataContractSerializer  maxItemsInObjectGraph="6553600"/>-->
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>

  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<standardEndpoints>
  <webHttpEndpoint>
    <standardEndpoint helpEnabled="true" automaticFormatSelectionEnabled="true" />
  </webHttpEndpoint>
</standardEndpoints>

然后我调用此服务以使用HttpGetResponse(URL)获取linkedinconnections。

        HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
        httpWebRequest.ContentType = "application/x-www-form-urlencoded";

        HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
        Stream responseStream = httpWebResponse.GetResponseStream();
        StreamReader streamReader = new StreamReader(responseStream);
        string response = streamReader.ReadToEnd();

网址如下:

https://127.0.0.1/Services/ITDService.svc/LinkedInConnections/CANDIDATEID/1/Token/598e977e-2e22-4fce-83e7-e59459f3f447/TokenSecret/f859c946-XXXXXXXXXXXXXXX-5b6f42668cf7/Verifier/84251/false

我收到404 Not found错误。并且,主要的是我无法调试此服务中的代码,尽管我已设置includeExceptionDetailInFaults =“true”。怎么调试呢?

非常感谢任何帮助。

谢谢,

1 个答案:

答案 0 :(得分:0)

尝试使用Fiddler查看您发送的实际请求。您可以查看标题信息以查找地址。