WCF 服务支持文件 jsdebug 无法加载

发布于 2024-07-05 05:46:49 字数 589 浏览 7 评论 0原文

我有一个从客户端 JavaScript 调用的 WCF 服务。 调用失败并出现 Service is null JavaScript 错误。 WebDevelopment 帮助程序跟踪显示加载 jsdebug 支持文件的调用会导致 404(文件未找到)错误。

重新启动 IIS 或清除临时 ASP.Net 文件或在 web.config 中的编译标记上设置 batch="false" 无法解决问题

从浏览器

.svc" rel="nofollow noreferrer">https://Myserver/MyApp/Services/MyService.svc

https://Myserver/MyApp/Services/MyService.svc/jsdebug 结果为 404。

问题似乎与 https 协议有关。 使用 http /jsdebug 下载支持的 JS 文件。

有任何想法吗?

TIA

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.

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

From the browser

https://Myserver/MyApp/Services/MyService.svc displays the service metadata

however

https://Myserver/MyApp/Services/MyService.svc/jsdebug results in a 404.

The issue seems to be with the https protocol. With http /jsdebug downloads the supporting JS file.

Any ideas?

TIA

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

海夕 2024-07-12 05:46:49

如果在完成所有可能的工作后您仍然遇到相同的错误。 只需添加“AJAX Enabled WCF-Service”即可。

If you still get the same error after all your possible work done. Just add a "AJAX Enabled WCF-Service".

孤独难免 2024-07-12 05:46:49

对我来说,问题如下: 我们将 MVC 添加到带有路由的解决方案中。 我们的 WCF 服务并没有被忽视。 我通过添加以下规则解决了这个问题(其中“WCF”是我们保存服务的文件夹)。

routes.IgnoreRoute("WCF/{*pathInfo}");

希望这可以节省某人几个小时。

For me the issue was the following; we added MVC to a solution with routing. Our WCF services were not being ignored. I resolved this by adding the following rule (where "WCF" is the folder we keep our services in).

routes.IgnoreRoute("WCF/{*pathInfo}");

Hope that saves somebody a few hours.

缱倦旧时光 2024-07-12 05:46:49

弄清楚了!

这是 web.config 中的服务配置部分

查看端点上的 bindingConfiguration 属性。 值“webBinding”指向绑定中的绑定名称=“webBinding”标记,这就是告诉服务使用 HTTPS 传输级别安全性的内容。 在我的例子中,属性值为空,导致通过 HTTPS 对 /js 或 /jsdebug 文件的 Web 服务请求失败并抛出 404 错误。

<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>

请注意,如果通过 http 而不是 https 访问服务(在没有证书的本地计算机上进行测试时),则绑定配置属性应该为空(“”)

希望这对某人有帮助。

Figured it out!

Here is the services configuration section from web.config

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>

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)

Hope this helps someone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文