7
votes

I can't figure out why I might be getting this error. It happens on an ajax call.

Any help is appreciated. Thanks!

This is the full error text:

-- 6/21/2010 6:09:10 PM -- System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x80004005): OutputStream is not available when a custom TextWriter is used. at System.Web.HttpResponse.get_OutputStream() at AjaxControlToolkit.ToolkitScriptManager.OutputCombinedScriptFile(HttpContext context) in C:\AjaxBuild\Ajax\Server\AjaxControlToolkit\ToolkitScriptManager\ToolkitScriptManager.cs:line 286 at AjaxControlToolkit.ToolkitScriptManager.OnInit(EventArgs e) in C:\AjaxBuild\Ajax\Server\AjaxControlToolkit\ToolkitScriptManager\ToolkitScriptManager.cs:line 246 at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context) at ASP.views_listen_twittertimeline_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\8f8e9134\ff8a3ded\App_Web_4vjkjyte.13.cs:line 0 at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass1.b__0() at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.b__3() at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func1 func) at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap(Action action) at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.ProcessRequest(HttpContext context) 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.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.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext) at System.Web.Mvc.WebFormView.RenderViewPage(ViewContext context, ViewPage page) at System.Web.Mvc.WebFormView.Render(ViewContext viewContext, TextWriter writer) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass14.<>c__DisplayClass16.b__13() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) at System.Web.Mvc.Controller.ExecuteCore() at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__4() at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0() at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass81.b__7(IAsyncResult _) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

5

5 Answers

11
votes

The stack trace contains the answer:

OutputStream is not available when a custom TextWriter is used. at System.Web.HttpResponse.get_OutputStream() at AjaxControlToolkit.ToolkitScriptManager.OutputCombinedScriptFile(HttpContext context) in C:\AjaxBuild\Ajax\Server\AjaxControlToolkit\ToolkitScriptManager\ToolkitScriptManager.cs:line 286 at AjaxControlToolkit.ToolkitScriptManager.OnInit(EventArgs e) in C:\AjaxBuild\Ajax\Server\AjaxControlToolkit\ToolkitScriptManager\ToolkitScriptManager.cs:line 246 at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

You're using the AjaxControlToolkit, which is a collection of server controls. Server controls are not supported by ASP.NET MVC. You may wish to call into the Javascript APIs of the AjaxControlToolkit instead of using the server controls, as this should give you the behavior you desire in an MVC-compliant manner.

7
votes

Your MVC view code probably has a syntax error in it. You probably see an error message in your error log but it won't stop the site from running since the View code isn't compiled the same way a standard class is.

So check your error log for any syntax error messages.

1
votes

I get the similar error if I change my AccountController (or HomeController) to be derived from my BaseController. (By default, each controller is derived from "Controller"). I had generic actions defined in my BaseController which is derived from Controller.

If I change back my AccountController to be derived from (default) "Controller", everything works fine. Not sure if it helps !

0
votes

Try to set CombineScripts="false" in ToolkitScriptManager initialization. It's not the root of the problem but it's on the right way.

0
votes

in my case it was a if operator within BeginFrom

@using (Html.BeginForm()) {
   <some html>
   @if(condition)
   {

   }
   <some html>

}