【发布时间】:2011-07-12 10:40:39
【问题描述】:
我的服务将被同一个盒子上的另一个应用程序(Adobe AIR)使用,我无法运行服务器。我目前正在盒子上运行 WCF 服务作为 Windows 服务来实现这一点。没有服务器意味着没有 REST(如果我有任何错误,请纠正我),但我仍然希望我的服务能够返回 JSON。
我一直在对此进行研究,发现很多人使用带有 webHttpBinding 的 REST 服务,然后在配置中设置 JSON 行为,但是由于上述原因,我相信我不能使用 REST。
因此,以此为背景,我的问题是:作为 basicHttpBinding 或 WSHttpBinding 运行的 WCF 服务能否返回 JSON 而无需我手动处理?
如果是这样,有人可以解释一下吗?
这是我的 app.config 服务的当前详细信息
<configuration>
<system.serviceModel>
<services>
<service name="WcfProjectLibrary.ProjectService">
<endpoint address="" binding="wsHttpBinding" contract="WcfProjectLibrary.IProjectService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfProjectLibrary/ProjectService/" />
</baseAddresses>
</host>
</service>
</services>
<!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>-->
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
</system.serviceModel>
</configuration>
谢谢
【问题讨论】:
标签: asp.net wcf air wcf-binding