【发布时间】:2011-09-01 06:18:14
【问题描述】:
我制作了简单的启用 AJAX 的 WCF,它在 localhost 上运行,但是当我尝试通过 HTTP 时,WCF 没有运行。如何配置 Web 配置以使其通过 HTTP 托管?我的 Web 配置创建了自动添加 WCF 并在 localhost 上运行:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="ASPXCommerceWCFServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="ASPXCommerceWCFService">
<endpoint address="" behaviorConfiguration="ASPXCommerceWCFServiceAspNetAjaxBehavior"
binding="webHttpBinding" contract="ASPXCommerceWCFService" />
</service>
</services>
</system.serviceModel>
【问题讨论】:
-
您的客户端是否在本地主机上运行,而服务在另一台机器上?你不能像那样进行跨域调用。
-
是的我知道但不知道如何配置请提供配置示例代码
标签: jquery asp.net wcf web-services httpwebrequest