2014-07-01 44 views
0

我在Web表單解決方案中添加了一個Web Api項目。現在我試圖從Web表單項目中引導Web Api。在Web Forms 3.5項目中引導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?

回答

1

我想你可能已經安排的語法「倒退」 ...試試這個:

WebApiConfig.Register(GlobalConfiguration.Configuration) 
+0

我會盡力追逐的錯誤一點點這點,如果我得到一個機會......我d建議您在VS中選擇一個全新的項目,選擇VB/MVC/WebApi *並將該項目用作參考*。合理? –

+0

修復了第一個問題。當我運行應用程序時,我現在得到以下錯誤:對象尚未初始化。確保在所有其他初始化代碼之後,在應用程序的啓動代碼中調用HttpConfiguration.EnsureInitialized()。 – user2054833