【问题标题】:bootstrapping Web Api in Web Forms 3.5 project在 Web Forms 3.5 项目中引导 Web Api
【发布时间】:2014-07-01 16:24:48
【问题描述】:

我已将一个 Web Api 项目添加到我的 Web 表单解决方案中。现在我正在尝试从我的 Web 表单项目中引导 Web Api。

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs on application startup
    GlobalConfiguration.Configure(AddressOf WebApi.WebApiConfig.Register) 
End Sub

但是,我收到以下错误:

'Configure' is not a member of 'System.Web.Http.GlobalConfiguration'.   

如何引导 Web API?

【问题讨论】:

    标签: asp.net vb.net web-services webforms


    【解决方案1】:

    我认为您可能已经安排了语法“向后”...试试这个:

     WebApiConfig.Register(GlobalConfiguration.Configuration)
    

    【讨论】:

    • 如果我有机会,我会试着追查这个错误......我建议你在 VS 中创建一个全新的项目,选择 VB / MVC / WebApi 并使用该项目作为参考。有意义吗?
    • 修复了第一个问题。我现在在运行应用程序时收到以下错误:对象尚未初始化。确保在所有其他初始化代码之后在应用程序的启动代码中调用 HttpConfiguration.EnsureInitialized()。
    猜你喜欢
    • 1970-01-01
    • 2011-02-23
    • 2019-04-22
    • 2011-09-08
    • 2018-01-03
    • 2010-12-08
    • 2013-07-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多