2

I have a problem that is only happening when my web app is deployed on our server (error 500). When I run the app locally, there is no error.

I have a view called "TestUnitaire.cshtml", the error I'm getting refers to the line where I call the XmlPreview action.

<div class="row">
    <div id="partialTestUnitaireConfig" class="col-lg-8">
        @Html.Action("TestUnitaireConfig", "CommandeTest", new { testId = Model })
    </div>

    <div id="partialXmlPreview" class="col-lg-4 xmlPreview">
        @Html.Action("XmlPreview", "CommandeTest", new { testId = Model })
    </div>
</div>

In the corresponding controller, the methods look like that :

[HttpGet]
[AuthorizeUser(ProfilList.Superuser, ProfilList.Administrateur, ProfilList.Visiteur)]
public ActionResult TestUnitaireConfig(int? testId = null)
{
    var ctu = new CTU();
    return PartialView("_TestUnitaireConfig", ctu);
}

[HttpGet]
[AuthorizeUser(ProfilList.Superuser, ProfilList.Administrateur, ProfilList.Visiteur)]
public ActionResult XmlPreview(int? testId = null)
{
    var ctu = new CTU();
    return PartialView("_XMLPreview", ctu);
}

Exception :

Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.

Stacktrace :

at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
   at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage)
   at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm)
   at System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter)
   at System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues)
   at ASP._Page_Views_CommandeTest_TestUnitaire_cshtml.Execute() in d:\IIS\sites\Views\CommandeTest\TestUnitaire.cshtml:line 29
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
   at System.Web.WebPages.StartPage.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I'm not sure what's wrong that makes it that it's only not working when the app is being deployed. I'll be happy to give more details if needed.

Thanks in advance for your help.

azekirel555
  • 577
  • 2
  • 8
  • 25
  • 1
    ok so what is the full error with stack trace? – Patrick Goode Oct 27 '19 at 16:04
  • Please provide the error and code line where you are getting the error. Also, how are you calling the the action to render `PartialView`? – user1672994 Oct 27 '19 at 17:05
  • @PatrickGoode & user1672994: Sorry for the delay, I've updated the question with the stacktrace. I'm getting the error on the second Html.Action call (XmlPreview). – azekirel555 Oct 28 '19 at 09:17
  • Could you please post the error message itself? Just to be sure, how do you deploy the app? Do you use `dotnet publish`? Does the deployment package contain .cshtml files? – Andrii Litvinov Oct 28 '19 at 09:20
  • Hi @AndriiLitvinov, I've edited it with the error message, I deploy the app with Azure DevOps. Yes, the deployment package contains .cshtml files. – azekirel555 Oct 28 '19 at 09:25
  • What if you publish the app and run the published output locally? – Andrii Litvinov Oct 28 '19 at 09:27
  • There is similar question at [this link](https://stackoverflow.com/questions/14065367/stack-trace-at-system-web-httpserverutility-executeinternal-error-executi). Did you check it already ? – Manoj Choudhari Oct 29 '19 at 14:17
  • Do not put files on IIS server that users do not have the credentials to read. Clients have GUEST credentials on a IIS and may not be able to read a file. Put data on the Shared drive that user can read. You ared trying to read the following file : d:\IIS\sites\Views\CommandeTest\TestUnitaire.cshtml – jdweng Oct 30 '19 at 13:58

1 Answers1

1

Take a look at Error executing child request for handler in view .maybe one of the mentioned senarios apply to you too. Since it works locally but doesnt work on Azure I am suspecting there is a problem with project configurations such as database connection string (maybe you didnt update your cnn for Azure)

F_IVI_L
  • 940
  • 9
  • 17