[ERROR]'System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure'

[ERROR]'System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure'

在VS.NET 2013中,新建MVC專案,並選取Web API後,會在Global.asax.cs中的

GlobalConfiguration.Configure(WebApiConfig.Register);

出現以下的錯誤,

'System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure'

The name 'WebApiConfig' does not exist in the current context

image

 

解決方式可參考「Solving System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure」,

開啟 Package Manager Console ,

然後輸入 Install-Package Microsoft.AspNet.WebApi.WebHost 按下 Enter

image

再重新建置就可以了!

 

參考資料

Solving System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure

Hi, 

亂馬客Blog已移到了 「亂馬客​ : Re:從零開始的軟體開發生活

請大家繼續支持 ^_^