【问题标题】:breeze 1.3.6 cannot get metadata微风 1.3.6 无法获取元数据
【发布时间】:2014-06-05 04:58:28
【问题描述】:

使用微风的Devcurry hottowelsignalr example 工作正常,直到我通过 nuget 将微风升级到 1.3.6。

chrome 中的 F12 显示它正在尝试从 http://localhost/api/breeze/Metadata 检索元数据,而之前它会使用 http://localhost/OnlineCollaborationWithSignalR/api/breeze/Metadata。这是呼叫的正确位置。似乎根目录中缺少应用程序的路径。即(OnlineCollaborationWithSignalR

更新 注意到 1.3.1 的发行说明。并随后将路由改为

public static class BreezeWebApiConfig {

    public static void RegisterBreezePreStart() {
      GlobalConfiguration.Configuration.Routes.MapHttpRoute(
          name: "BreezeApi",
          routeTemplate: "breeze/{controller}/{action}"
      );
    }
  }

和 app/viewmodels/home.js 到

  // service name is route to the Web API controller
    var serviceName = 'breeze/Breeze';

 from
  // service name is route to the Web API controller
    var serviceName = 'api/Breeze';

它仍然失败并出现与上述相同的错误。

【问题讨论】:

    标签: breeze hottowel


    【解决方案1】:

    您能否确认 API 做出了相应响应?

    根据您的 routeTemplate,应该是。

    http://localhost/breeze/Breeze/Metadata

    更新:

    是的,如果您的配置是这样的。应该是

    http://localhost/OnlineCollaborationWithSignalR/breeze/Breeze/Metadata

    我不熟悉具体的项目,但我下载并更新了它。然后我进行了您指定的更改,并且我收到了来自 API 的响应。虽然我收到了一个错误(很可能是不相关的),但它实际上是正确路由的。

    作为记录,我得到的错误是:

    "The provider for invariant name 'System.Data.SqlClient' is specified multiple times in the application configuration. The invariant name must be unique for each configured provider."

    【讨论】:

    • 根据我对 mvc/webapi routeconfig 的理解,因为我的应用程序从 localhost/OnlineCollaborationWithSignalR 运行,所以路由应该是 localhost/OnlineCollaborationWithSignalR/breeze/Breeze/Metadata
    • 我怀疑您的 SQL 问题与您更改为使用 SQLExpress 有关,当我更改为使用 IIS 而不是 vs2012 的 iisexpress 时,它会提示您使用 sqlexpress 而不是 localdb。 IVe 从头开始​​再次尝试,但仍然收到元数据错误,因为它试图从 iis 根目录而不是部署位置请求资源。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-08
    • 1970-01-01
    • 2014-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多