首页 > 解决方案 > 我的 Javascript 代码找不到 WCF 服务

问题描述

我的服务提供商已将我的代码迁移到新服务器,而我的 AJAX 代码无法再找到我的 WCF 服务。我从浏览器得到的消息是:

HTTP404: NOT FOUND – 服务器没有找到任何匹配请求的 URI(统一资源标识符)的东西。获取 - http://www.example.com/WebServices/TBox.svc/js

如果我直接浏览到本地 PC 上的 Web 服务 ( http://localhost:64805/WebServices/TBox.svc ),我会收到一条消息“这是 Windows© Communication Foundation 服务。......'。但是,如果我浏览我的托管服务,我会收到 404 Page Not Found 错误。

我从我的 web.config 中附加了一个部分,因为我怀疑它可能与此有关。

任何帮助,将不胜感激。

<system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="TimeboxAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
        <behavior name="TBoxAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
        <behavior name="WebMethodForTestingAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior>
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service name="Timebox">
        <endpoint address="http://www.example.com/WebServices/Timebox.svc" behaviorConfiguration="TimeboxAspNetAjaxBehavior" binding="webHttpBinding" contract="Timebox" />
      </service>
      <service name="TBox">
        <endpoint address="http://www.example.com/WebServices/TBox.svc" behaviorConfiguration="TBoxAspNetAjaxBehavior" binding="webHttpBinding" contract="TBox" />
      </service>
      <service name="WebMethodForTesting">
        <endpoint address="" behaviorConfiguration="WebMethodForTestingAspNetAjaxBehavior" binding="webHttpBinding" contract="WebMethodForTesting" />
      </service>
    </services>
  </system.serviceModel>

问候,扫罗

标签: web-serviceswcfservice

解决方案


推荐阅读