WCF服务支持文件jsdebug加载失败 [英] WCF Service support file jsdebug fails to load
问题描述
我有一个会从客户端的JavaScript称为WCF服务。呼叫失败,服务为空JavaScript错误。 web开发帮手跟踪显示调用加载一个404(未找到文件)错误jsdebug支持文件的结果。
I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error.
重新启动IIS或清除出临时ASP.Net文件或在web.config中的编译标记设置一批=假不能解决问题
Restarting IIS or clearing out the Temp ASP.Net files or setting batch="false" on the compilation tag in web.config does not resolve the problem
从浏览器
HTTPS://Myserver/MyApp/Services/MyService.svc显示服务元数据
https://Myserver/MyApp/Services/MyService.svc displays the service metadata
然而
HTTPS://Myserver/MyApp/Services/MyService.svc/jsdebug结果在404
https://Myserver/MyApp/Services/MyService.svc/jsdebug results in a 404.
这个问题似乎与HTTPS协议。使用HTTP / jsdebug下载支持JS文件。
The issue seems to be with the https protocol. With http /jsdebug downloads the supporting JS file.
任何想法?
TIA
推荐答案
想通了!
下面是web.config中的服务配置部分
Here is the services configuration section from web.config
看端点上的bindingConfiguration属性。值webBinding指向绑定名称=webBinding的标签绑定,这就是告诉服务使用传输层安全性是HTTPS。在我的情况该属性值是空导致Web服务请求/ JS或/ jsdebug文件通过HTTPS失败,并抛出一个404错误。
Look at the bindingConfiguration attribute on the endpoint. The value "webBinding" points to the binding name="webBinding" tag in the bindings and that is what tells the service to use Transport level security it HTTPS. In my case the attribute value was empty causing the webservice request to the /js or /jsdebug file over HTTPS to fail and throw a 404 error.
<services>
<service name="MyService">
<endpoint address="" behaviorConfiguration="MyServiceAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Services.MyService" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
注意bindingConfiguration属性应该是空的(),如果该服务是通过HTTP来代替https访问(不带证书的本地计算机上进行测试时)
Note that the bindingConfiguration attribute should be empty ("") if the service is accessed via http instead of https (when testing on local machine with no certs)
希望这可以帮助别人。
这篇关于WCF服务支持文件jsdebug加载失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!