【发布时间】:2013-11-22 12:26:08
【问题描述】:
我在 WCF 中并不是那么完美,并且仍然是一个学习者。我学习 WCF 服务的地方告诉我,WCF 服务异步方法也返回与原始方法相同的数据类型。它在我下载的项目上运行良好,但使用相同的配置我创建了一个新项目并且它没有返回原始方法的数据类型。而是像这样的响应类型:
如您所见,它显示了isEmailExistsResponse 类型。 如何让它返回 bool 类型?
我的配置
客户端:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="WCORE.IService1" name="BasicHttpBinding_IService1"/>
</client>
</system.serviceModel>
服务器端:
<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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
我在客户端和服务上都使用 .NET 4.5。但是我的服务器安装的是4.0。因此,如果服务在最终部署时遇到问题,我可能会切换到 4.0。
WCF 客户端设置:
【问题讨论】:
-
你贴出图片的代码???哦,来吧!
-
它不是“代码图片”,而是错误。以便人们更好地理解。
标签: c# asp.net .net wcf web-services