The specified argument was out of range (parameter name: site)

I just started working with asp.net mvc 4. I created this simple controller class and did this little coding, but when I start my project, it gives an error. I do not know what this error is and how to fix it. help me with this.

public class HomeController : Controller 
{
    public string Index()
    {
        return typeof(Controller).Assembly.GetName().Version.ToString();
    }
}

when i run the app on google chrome it throws the following error

Server error in application "/".

The specified argument was out of range. Parameter Name: Site

Description: An unhandled exception occurred during the execution of the current web request. View the stack trace for more information about the error and its occurrence in the code.

: System.ArgumentOutOfRangeException: . :

: -. .

:

[ArgumentOutOfRangeException: . : ]

System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +303

[HttpException (0x80004005): . > : ]

System.Web.HttpRuntime.FirstRequestInit( HttpContext) +9951956    System.Web.HttpRuntime.EnsureFirstRequestInit( HttpContext) +101    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext) +254

: Microsoft.NET Framework : 4.0.30319; ASP.NET: 4.0.30319.34248 **

-1
2

  • Windows
  • Internet Information Services
  • .

,

+2

. Index , RegisterRoutes, . MVC ActionResult , . ActionResult Json, .

public ActionResult Index()
    {
        return this.Json(typeof(Controller).Assembly.GetName().Version.ToString());
    }
0

Source: https://habr.com/ru/post/1689261/


All Articles