MvcScriptManager.ScriptManager.WriteScripts(String[] scriptKeys, TextWriter outputWriter, HttpContext context) throws "An unhandled exception has occurred"

Dec 3, 2010 at 10:15 PM

Hi,

I've developed an MVC web application that works well on my PC. But when I publish it on the Test Server (Windows 2003R2 + IIS6, .Net 3.5), sometimes (usually at the first attempt to reach the specific view), the view (I mean the page) loads with "Javascript Error" and stop working. The javascript error is:

_____________________________________________________
Message: Object expected
Line: 3
Char: 2
Code: 0
URI: http://*******.******.com/******/CombineScriptHandler.aspx?s=f3f9c8fe%3bcbfe8180%3b6df3a7b4%3bd5a0748d%3be6fab769%3b18db8ae0%3bdf4f0753%3b7e177337%3bee143d4b%3b594a24c2%3b3fa70be6%3b42a270dc%3b6597e079%3b46d3344f%3b8b0baa5b%3bf50480c%3bf876f71f%3b94a7bf8b&c=1&e=1&ed=0&d=18da433015484f1a8b1091135ba498bb
-------------------------------------------------------

Usually when user refreshes the page, page loads good without error at the second attempt!

This is one of the Error logs of the application (The other logs are relatively the same):

*******************************************************************************

Event Type:        Warning
Event Source:    ASP.NET 2.0.50727.0
Event Category:                Web Event
Event ID:              1309
Date:                     12/2/2010
Time:                     12:44:19 PM
User:                     N/A

Computer:          *********
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 12/2/2010 12:44:19 PM
Event time (UTC): 12/2/2010 5:44:19 PM
Event ID: cd0f117863054672b8801cd4d072a03c Event sequence: 3 Event occurrence: 1 Event detail code: 0

Application information:
    Application domain: /**/W3SVC/735585995/Root/***-1-129357854587607977
    Trust level: Full
    Application Virtual Path: /***
    Application Path: D:\**********\******\*****\v1\
    Machine name: **-*****

Process information:
    Process ID: 1620
    Process name: w3wp.exe
    Account name: *******\svcIISpool

Exception information:
    Exception type: InvalidOperationException
    Exception message: Script key '2b38bf1' doesn't exist.

Request information:
    Request URL: http://******************.******.com/******/CombineScriptHandler.aspx?s=2b38bf112/2/2010 12:44:19 PMbde30f84112/2/2010 12:44:19 PMb1e97a7e812/2/2010 12:44:19 PMb57296d6512/2/2010 12:44:19 PMb726c0b012/2/2010 12:44:19 PMb79a06f4712/2/2010 12:44:19 PMb11b3bb6812/2/2010 12:44:19 PMbeef66fe512/2/2010 12:44:19 PMb7a33ceba&c=1&e=1&ed=0&d=4648eed91a344173a632ac3e5c270104
    Request path: /***/CombineScriptHandler.aspx
    User host address: **.**.*.***
    User: tazizi
    Is authenticated: True
    Authentication Type: Forms
    Thread account name: ******\svcIISpool

Thread information:
    Thread ID: 1
    Thread account name: *******\svcIISpool
    Is impersonating: False
    Stack trace:    at MvcScriptManager.ScriptManager.WriteScripts(String[] scriptKeys, TextWriter outputWriter, HttpContext context)
   at MvcScriptManager.ScriptManager.OutputCombinedScriptFile(HttpContext context)
   at MvcScriptManager.CombineScriptHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Custom event details:

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

*******************************************************************************

The related code on my ASP.NET MVC master page is:

    <mvc:ScriptManager ID="ContentEditScripts" runat="server" HttpExpirationInDays="0"
        EnableHttpCompression="true" EnableViewState="false">
        <Scripts>
            <mvc:ScriptReference Path="~/Content/js/DateFields.js" EnableCrunching="true" />
            <%--
        Developer note: These scripts were used to conver <textarea /> to RTE (uEditor).
                        By using tinyMCE, there is no need for them any more.
            <mvc:ScriptReference Path="~/Content/js/uEditor.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/EditorDialog.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/Editor.js" EnableCrunching="true" />
            --%>
            <mvc:ScriptReference Path="~/Content/js/MediaUpload.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/MediaLibrary.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/ImageUpload.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/ImageReference.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/FileUpload.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/VideoUpload.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/VideoReference.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/MediaPreview.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/LinkEditorDialog.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/LinkEditor.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/jquery/jquery.maketree.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/EntitlementsTree.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/TagDialog.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/EditContentTaxonomy.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/EditContent.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/tiny_mce/jquery.tinymce.js" EnableCrunching="true" />
            <mvc:ScriptReference Path="~/Content/js/tiny_mce/jquery.tinymce.load.js" EnableCrunching="true" />
        </Scripts>
    </mvc:ScriptManager>

 

Any idea about this error?

Thx,

-Tohid

Coordinator
Dec 3, 2010 at 10:53 PM

Looks like you are using an old build.

Please download and user the Oct 2009 release.

Dec 6, 2010 at 6:25 PM

Thuang,

You are awesome dude. The problem has been solved by replacing the dll on the test server.

Regards,

-Tohid

 

Jan 27, 2011 at 9:31 PM

OK.

After 2 months test, we moved the application from Test Server to Production Server (Windows 2003R2 + IIS6, .Net 3.5). The Production Server configuration is as the same as Test Server.

The only difference between application's web.config file in Test and Prod Server, is:

In the Test environment, web.config contains: <compilation debug="true"but in Prod, it contains: <compilation debug="false">

Now, we get the following error in the error log:

Event log entry:

Event Type: Warning
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1309
Date:  1/26/2011
Time:  4:29:03 PM
User:  N/A

Computer: ********
Description:
 Event code: 3005
 Event message: An unhandled exception has occurred.
 Event time: 1/26/2011 4:29:03 PM
 Event time (UTC): 1/26/2011 9:29:03 PM
 Event ID: 0c60976abfaf4b5e81d86a2f465ca8e5
 Event sequence: 14 Event occurrence: 1 Event detail code: 0 

Application information:
     Application domain: /**/W3SVC/319344391/Root/***-2-129405509275644752
     Trust level: Full
     Application Virtual Path: /***
     Application Path: *:\********\*******\***\
     Machine name: **-*****

Process information:
     Process ID: 4404
     Process name: w3wp.exe
     Account name: ******\svcIISpool

Exception information:
     Exception type: FileNotFoundException
     Exception message: Could not load file or assembly 'EcmaScript.NET.modified, Version=0.1.1.0, Culture=neutral,

PublicKeyToken=7d53ba4f537753a5' or one of its dependencies. The system cannot find the file specified.

Request information:
     Request URL: http://**********.******.com/***/CombineScriptHandler.aspx?s=L2Ntcy9Db250ZW50L2pzL2ZpcmVidWd4LmpzfE58fHw1/26/2011 4:29:03

PMd1/26/2011 4:29:03 PMbL2Ntcy9Db250ZW50L2pzL3V0aWwvdHlwZS5vZi5qc3xOfHx81/26/2011 4:29:03
PMbL2Ntcy9Db250ZW50L2pzL3V0aWwvdXRpbGl0aWVzLmpzfFl8fHw1/26/2011 4:29:03 PMd1/26/2011 4:29:03
PMbL2Ntcy9Db250ZW50L2pzL3V0aWwvZGF0ZUZvcm1hdC5qc3xZfHx81/26/2011 4:29:03
PMbL2Ntcy9Db250ZW50L2pzL2pxdWVyeS9qcXVlcnkuaWZyYW1lci5qc3xZfHx81/26/2011 4:29:03
PMbL2Ntcy9Db250ZW50L2pzL2pxdWVyeS9qcXVlcnkucXRpcC0xLjAuMC1yYzMubWluLmpzfFl8fHw1/26/2011 4:29:03
PMd1/26/2011 4:29:03 PMbL2Ntcy9Db250ZW50L2pzL0FqYXhTZXR0aW5ncy5qc3xZfHx81/26/2011 4:29:03
PMbL2Ntcy9Db250ZW50L2pzL0dsb2JhbE1hbmlwdWxhdGlvbi5qc3xZfHx81/26/2011 4:29:03
PMbL2Ntcy9Db250ZW50L2pzL0NvbnRlbnRSZXBvcnQuanN8WXx8fA1/26/2011 4:29:03 PMd1/26/2011 4:29:03
PMd&es=1&c=1&e=1&ed=0
     Request path: /***/CombineScriptHandler.aspx
     User host address: 172.16.1.26
     User: [WHY IT IS EMPTY?]
     Is authenticated: False [SHOULD BE TRUE]
     Authentication Type: [?]
     Thread account name: ******\svcIISpool

Thread information:
     Thread ID: 7
     Thread account name: ******\svcIISpool
     Is impersonating: False
     Stack trace:    at Yahoo.Yui.Compressor.JavaScriptCompressor..ctor(String javaScript, Boolean isVerboseLogging,

Encoding encoding)
   at Yahoo.Yui.Compressor.JavaScriptCompressor.Compress(String javaScript, Boolean isVerboseLogging, Boolean

isObfuscateJavascript, Boolean preserveAllSemicolons, Boolean disableOptimizations, Encoding encoding)
   at Yahoo.Yui.Compressor.JavaScriptCompressor.Compress(String javaScript, Boolean isVerboseLogging)
   at MvcScriptManager.YuiJavaScriptCompressor.Minify(String source)
   at MvcScriptManager.ScriptManager.GetScript(String scriptKey, HttpContext context, IUniqueKeyEncoder

uniqueKeyEncoder)
   at MvcScriptManager.ScriptManager.WriteScripts(IEnumerable`1 scriptKeys, TextWriter outputWriter, HttpContext

context, IUniqueKeyEncoder uniqueKeyEncoder)
   at MvcScriptManager.ScriptManager.OutputCombinedScriptFile(HttpContext context)
   at MvcScriptManager.CombineScriptHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

  Custom event details:
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

______________________________________________________________________________________________

Have any idea what's "EcmaScript.NET.modified.DLL" and what's the solution?
Regards
Coordinator
Jan 27, 2011 at 10:04 PM

Without looking in detail...it seems like you are missing one dll.

Please include the missing dll in your bin folder (the dll should be in the download zip file).

Jan 28, 2011 at 5:41 PM
thuang wrote:

Without looking in detail...it seems like you are missing one dll.

Please include the missing dll in your bin folder (the dll should be in the download zip file).

In Production server, we replace <compilation debug="false"> with <compilation debug="true"> in web.config, and surprisingly the application works well now! 

Actually I checked the Test Server and there is no "EcmaScript.NET.modified.dll" in it (Neither in bin folder nor GAC). 

Have any explanation?

I definitely want to turn of debug mode in Production Server to improve performance. Can I do that with out adding this EcmaScript.NET.modified.dll to the web application's bin folder?

Coordinator
Jan 28, 2011 at 6:53 PM

It's the yahoo script compressor that requires this dll. Check out the following project if you need more detail:

http://yuicompressor.codeplex.com