PDA

View Full Version : [CLOSED] Randomly Displaying Warning Message - The web.config file for this project is missing the required AjaxRequestModule



jcarlos
Mar 14, 2014, 8:47 PM
Hi, I am developing a project using Ext.Net.MVC / Razor engine since a months ago.
Besides the very poor performance in the design mode of the views (.cshtml / razor) when using the components of the Ext.Net.MVC and some delay caused by the dynamic compilation of the views to be rendered in their first request, the application is running relatively well.
The main problem is that the application is randomly (< 1% of requests) displaying the warning message:
"The web.config file for this project is missing the required AjaxRequestModule."
In addition, all the extjs generated script code rendered by Ext.Net is being displayed in the client browser.
It appears that the message is being displayed when the application is in the phase of initialization, but it will not always occur and I cannot find a way to reproduce it.
It is important to emphasize that the "DirectRequestModule" was/is configured in web.config by the installation of the Ext.Net package.
What could be the cause and how can I prevent it?
Is there another elegant way to treat this case (i.e. internal error 500) instead of displaying the script source code and a message to the end user?

Best regards, thanks,

Jos? Carlos.

geoffrey.mcgill
Mar 15, 2014, 1:37 AM
In addition, all the extjs generated script code rendered by Ext.Net is being displayed in the client browser.

This is very strange. I don't ever remember running across this kind of problem before.

I will discuss with the Dev Team and we'll get back to you with any questions.

Daniil
Mar 17, 2014, 5:45 AM
I feel it might be a problem with a host server.

Vladimir
Mar 19, 2014, 6:40 PM
The main problem is that the application is randomly (< 1% of requests) displaying the warning message:
"The web.config file for this project is missing the required AjaxRequestModule."

Please update from SVN and retest, the issue should be fixed now



Besides the very poor performance in the design mode of the views (.cshtml / razor) when using the components of the Ext.Net.MVC and some delay caused by the dynamic compilation of the views to be rendered in their first request, the application is running relatively well.

Design mode is totaly inder VS control, Ext.Net doesn't execute any logic during design mode

jcarlos
May 01, 2014, 1:35 PM
Please update from SVN and retest, the issue should be fixed now

Hi Vladimir, sorry for the delay on the feedback, I didn't see your response.
Anyway, I updated to the last version from the Nuget (2.5.1) some weeks ago. Is this release updated with this fix?
I'm not certain on this but seems that the message about the web.config it is not displayed anymore but the issue about displaying the source code is still happening.
I implemented an IExceptionFilter and could get the entire exception tracing message as below:


<Type>System.ObjectDisposedException</Type>
<Message>Cannot write to a closed TextWriter.</Message>
<Source>mscorlib</Source>
<StackTrace> at System.IO.__Error.WriterClosed()
at System.IO.StringWriter.Write(String value)
at System.Web.HttpResponseWrapper.Write(String s)
at Ext.Net.MVC.PartialViewResult.RenderScript(Control lerContext context, String script)
at Ext.Net.MVC.PartialViewResult.RenderRazorView(Cont rollerContext context, RazorView razorView)
at Ext.Net.MVC.PartialViewResult.ExecuteResult(Contro llerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActio nResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActio n(ControllerContext controllerContext, String actionName)</StackTrace>




Seems that the Ext.Net is trying to write the script to a closed writer.

Could you evalute this, please?

Regards,

Jose Carlos.

Vladimir
May 01, 2014, 7:39 PM
Your stack trace shows that exception occurs inside PartialViewResult
So, we need test case which demonstrates how do you work with PartialViewResult and that case should reproduce the issue

jcarlos
May 01, 2014, 9:13 PM
Hi Vladimir, I don't know why this thread was closed.
The view that is being rendered has many partial views that is conditionally rendered based on business rules.
I checked the log of the exceptions with exactly this kind of occurrence, but it is very random, not specifically in a determined action/PartialViewResult.
The exception seems to occurs only when the application is being started (in development machine) or at the first startup after the application was deployed/updated.
A very simplified case of the scenario (not the real case due to its complexity) when the exception randomly occurs is the below.

myController.cs:



public partial class myController : Controller
{
public virtual ActionResult Index()
{
Random r = new Random();

ViewResult viewResult = View(new MyModel());

viewResult.ViewBag.bDet2 = r.Next(2) == 0;
viewResult.ViewBag.bDet3 = r.Next(2) == 1;

return viewResult;
}

public virtual ActionResult Det1(MyModel model, string containerId)
{
return new Ext.Net.MVC.PartialViewResult() { Model = model, RenderMode = RenderMode.AddTo, ContainerId = containerId };
}

public virtual ActionResult Det2(MyModel model, string containerId)
{
return new Ext.Net.MVC.PartialViewResult() { Model = model, RenderMode = RenderMode.AddTo, ContainerId = containerId };
}

public virtual ActionResult Det3(MyModel model, string containerId)
{
return new Ext.Net.MVC.PartialViewResult() { Model = model, RenderMode = RenderMode.AddTo, ContainerId = containerId };
}
}


index.cshtml:



@model MyModel

@{
Layout = "~/Views/Shared/Master.cshtml";
}

@section myBody
{
var X = Html.X();

var xPanel = X.Panel().Border(false).Layout(LayoutType.Fit);

xPanel.Items(X.Container().ID("Det1").ItemsFromAction("Det1", new { model = Model, containerId = "Det1" }));

if (ViewBag.bDet2)
{
xPanel.Items(X.Container().ID("Det2").ItemsFromAction("Det2", new { model = Model, containerId = "Det2" }));
}

if (ViewBag.bDet3)
{
xPanel.Items(X.Container().ID("Det3").ItemsFromAction("Det3", new { model = Model, containerId = "Det3" }));
}

// dozens of others conditional partial views here

@xPanel;
}

geoffrey.mcgill
May 02, 2014, 1:14 AM
Please edit your previous posts and wrap all code samples in [CODE] tags.

Daniil
May 02, 2014, 5:56 PM
Thank you for wrapping the code in [CODE] tags. Please do that in the future as well. Actually, for exception stack traces as well.


Anyway, I updated to the last version from the Nuget (2.5.1) some weeks ago. Is this release updated with this fix?

Yes, it should contain the fix that Vladimir meant.


I don't know why this thread was closed.

There is a month and half between post #4 and #5. And post #4 was from our side. If no activity from a user for a while we close a thread. Though, please feel free to post any new info related to the initial topic.


I checked the log of the exceptions with exactly this kind of occurrence, but it is very random, not specifically in a determined action/PartialViewResult.

Random, but how often?

Currently, we cannot reproduce the Exception.

Vladimir
May 20, 2014, 8:37 AM
Update here
http://forums.ext.net/showthread.php?35201-Random-Ext-Net-Mvc-Razor-Issues-NuGet-Deployment&p=158841&viewfull=1#post158841