[英]DotNetOpenAuth throwing an error in WCF
我正在使用第三方库来获取项目集合。该API基于DotNetOpenAuth。
通过简单的控制台应用程序进行测试时,用于获取数据的api调用可以正常工作。
但是,我的目标是在Web服务中使用此API。 当我测试我的Web服务时,用于获取数据的相同API调用将引发异常:
“发送直接消息或获取响应时发生错误。”
错误代码为500。
我感到奇怪的是,同一API调用可从控制台应用程序运行,但不能通过Web服务调用运行。 救命!
webconfig:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
我知道发生了什么事。
1)在API中,我正在请求分页结果,它不是以0开头。当我发送> 1作为页面偏移量时,它可以工作。
2)我应该已经注意到,在此模棱两可的错误消息下,正在返回服务器错误代码(500)。 90%的时间意味着您将废话发送到服务器。
问题解决了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.