DotNetOpenAuth在WCF中抛出错误
本文关键字:出错 错误 WCF DotNetOpenAuth | 更新日期: 2023-09-27 18:19:25
我使用第三方库来获取项目集合该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%的情况下,这意味着你在向服务器发送垃圾信息,呵呵。
问题解决了!