Creating ASP.NET Web API in Azure Project

When porting ASP.NET Web API to Azure Project, you may encounter error 404 when trying to call the restful api.

To solve this problem, add a Global Application Class (Global.asax) in your Azure Project.

Lastly replace the Application_Start method in Global.asax.cs with the below code:

        protected void Application_Start(object sender, EventArgs e)
        {
            GlobalConfiguration.Configuration.Routes.MapHttpRoute(
               name: "api",
               routeTemplate: "api/{controller}",
               defaults: new { controller = "yourController" });
        }

Referenced from CarlosFigueira

Advertisements
This entry was posted in Azure and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s