Asp.net core 6.0 with MVC application - Unable to launch razor view which is having partial view after deploying in IIS 10 version on windows server 2016.
I have developed MVC web application with .net core 6.0 and I am using these technologies...
- Web API (Hosted on same server in IIS)
- Entity Framework
- SQL Server
- Razor views, JavaScript, JQuery & Bootstrap.
- Apexcharts
Issue : After deploying in IIS 10 on windows server 2016, I'm able to browse razor view page with very basic controls(like jquery datatable and postedFiles button) and there is no code on my controller1 index but unable to launch razor view page in which i have implemented partial view and in controller2 Index event i have added code to fetch data from API(which is hosted on same server IIS) to show in apexcharts.
Installed below exe files on windows server 2016
- dotnet-hosting-6.0.26-win
- dotnet-sdk-6.0.418-win-x64
- aspnetcore-runtime-6.0.23-win-x64
Package to deploy on server
- I have used VS2022 to develop application and i have used publish option to generate package and after publishing successfully i have copied all the files from the published folder and pasted on windows server->IIS->MyWebsite virtual directory folder.
When i try to launch the view which has partial view I'm getting below error message:
An unhandled exception occurred while processing the request.> NullReferenceException: Object reference not set to an instance of an object.> AspNetCoreGeneratedDocument.Views_Shared_Dashboard.ExecuteAsync() in
Dashboard.cshtml
, line 1686
The line 1686 is my partial view...
<div class="col-md-8" id="Container"> > @{> line 1686 --> await Html.RenderPartialAsync("~/Views/Shared/_Test.cshtml");> }> </div>Full ExceptionDetails
Show raw exception details> System.NullReferenceException: Object reference not set to an instance of an object.> at AspNetCoreGeneratedDocument.Views_Shared_Dashboard.ExecuteAsync() in C:\Users\name\source\repos\MVCPrj\MVCPrj-UI\Views\Shared\Dashboard.cshtml:line 1686> at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)> at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)> at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)> at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable
1 statusCode)> at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable
1 statusCode)> at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)> at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)> at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|22_0(ResourceInvoker invoker, IActionResult result)> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync]> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync]> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()> --- End of stack trace from previous location ---> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()> --- End of stack trace from previous location ---> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)> at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)> at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)> at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)> at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)> at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)> at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)> at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)