Saturday, August 1, 2015

Run time error in Global.asax : Line 1: <%@ Application Codebehind="Global.asax.cs"

I was working on a webapi project and created it successfully. It seemed to be all right, until I hosted it in the application. After hosting, browsed the api and got an error of type


Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'Example.WebAPISample' 

Source Error: 



Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="Example.WebAPISample" Language="C#" %>


The error was pointing it to be an issue with the Global.asax file. Googled it and found that build action for the project should output the result to "bin" folder rather than "bin/debug" (was something like that).

I checked this option and found that was also fine. So before giving it up, gave a one last try. Cleaned the solution and build it and it worked. For some reason, the solution wasn't getting build properly earlier. But this time it worked and solution got built successfully. Browse the application and this time it worked fine. 

So this was one of the cause of issue with my application. Hope it helps others for whom the other option is not working. Happy coding...!!!

No comments:

Post a Comment