.NET Runtime Errors in Version 2.7

Nov 18, 2012 at 12:56 PM

Getting several .NET Runtime Errors since upgrading to version 2.7. They are as follows. Please help as my event logs are filling up with this stuff since the upgrade. Thanks:

ERROR #1

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
Stack:
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32, IntPtr)
   at System.Web.Hosting.IIS7WorkerRequest.GetServerVariableInternal(System.String)
   at System.Web.Hosting.IIS7WorkerRequest.GetServerVariable(System.String)
   at System.Web.Hosting.IIS7WorkerRequest.GetServerName()
   at System.Web.HttpRequest.get_Url()
   at .Core.Web.HttpModules.ReferrerModule+<>c__DisplayClass8.<ContextBeginRequest>b__5(System.Object)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
   at System.Threading.ExecutionContext.runTryCode(System.Object)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

 

ERROR #2

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/ROOT

Process ID: 4312

Exception: System.ArgumentException

Message: Value does not fall within the expected range.

StackTrace:    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Web.Hosting.IIS7WorkerRequest.GetServerVariableInternal(String name)
   at System.Web.Hosting.IIS7WorkerRequest.GetServerVariable(String name)
   at System.Web.Hosting.IIS7WorkerRequest.GetServerName()
   at System.Web.HttpRequest.get_Url()
   at BlogEngine.Core.Web.HttpModules.ReferrerModule.<>c__DisplayClass8.<ContextBeginRequest>b__5(Object state) in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Web\HttpModules\ReferrerModule.cs:line 233
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Nov 18, 2012 at 5:11 PM

Hi there,

The error happens while accessing  context.Request.Url

Is the request Url very long or containing strange characters?

Nov 20, 2012 at 4:40 PM

Thank you, neuromancer. Yes, we do know that the client used strings that contained special characters in the past and every time the pages loaded in version 2.0 the site would crash. We have since asked her NOT to use these special characters but they have hundreds of thousands of posts and finding old posts that contains special characters in the URL seems nearly impossible given the number of XML files we'd have to sift through.

We just upgraded to version 2.7. The site seems more stable but the Event Logs are filling up with errors.

Do you, or does anyone, know of a way to fix this aside from searching hundreds of thousands of XML files for a special character in the URL? As long as the site stays up I am fine for now but I do need to somehow resolve this issue.

Thanks

Coordinator
Nov 20, 2012 at 5:46 PM
BizCom wrote:
Do you, or does anyone, know of a way to fix this aside from searching hundreds of thousands of XML files for a special character in the URL? As long as the site stays up I am fine for now but I do need to somehow resolve this issue.

What's an example of URL that gives you special character error? We have to be able to re-produce to fix it.

Nov 20, 2012 at 6:25 PM
BizCom wrote:

We just upgraded to version 2.7. The site seems more stable but the Event Logs are filling up with errors.

Do you, or does anyone, know of a way to fix this aside from searching hundreds of thousands of XML files for a special character in the URL? As long as the site stays up I am fine for now but I do need to somehow resolve this issue.

Thanks

How about disabling the Referrer extension? Is it an option?

If not, you could tweak the code Referrer.cs to supress the exception. It's a hack rather than proper solution though.

Cheers

Nov 26, 2012 at 12:00 AM

Thanks for the info, neuromancer. My apologies, but I have no idea how to disable the Referrer extension. Is this something done in the web.config? If so, where. The blog crashed four times in as many days and it is getting frustrating. Would supressing the Referrer.cs allow the blog to continue functionsing as it does now? If so, how do I do that? Not a developer - I'm a server admin.

My Event Logs are piling up with BlogEngine errors and it will not stay working more than a day before I have to remove all of the XML files from the Post folder and re-add them. This gets it working for a bit until (I'm purely guessing) someone clicks on a post that may contains a special character in the URL. There are hundreds of XML files so finding the Special Character that may be causing this will not be an easy task.

Again, thank you very much for your assistance.

Event code: 3005

Event message: An unhandled exception has occurred.

Event time: 11/25/2012 6:46:13 PM

Event time (UTC): 11/25/2012 11:46:13 PM

Event ID: b9fc1d5096144f27b1d9eb5c895d50ab

Event sequence: 5

Event occurrence: 1

Event detail code: 0

 

Application information:

Application domain: /LM/W3SVC/...

Trust level: Full

Application Virtual Path: /

Application Path: E:\Blog\wwwroot\

Machine name: Server15

 

Process information:

Process ID: 2108

Process name: w3wp.exe

Account name: Server15\ApplicationPool

 

Exception information:

Exception type: XmlException

Exception message: Invalid character in the given encoding. Line 1807, position 10453.

at System.Xml.XmlTextReaderImpl.Throw(Exception e)

at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)

at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)

at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)

at System.Xml.XmlTextReaderImpl.ReadData()

at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)

at System.Xml.XmlTextReaderImpl.ParseText()

at System.Xml.XmlTextReaderImpl.ParseElementContent()

at System.Xml.XmlTextReaderImpl.Read()

at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)

at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)

at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)

at System.Xml.XmlDocument.Load(XmlReader reader)

at System.Xml.XmlDocument.Load(String filename)

at BlogEngine.Core.Providers.XmlBlogProvider.SelectPost(Guid id) in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Providers\XmlProvider\Posts.cs:line 227

at BlogEngine.Core.Post.DataSelect(Guid id) in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Post.cs:line 1439

at BlogEngine.Core.BusinessBase`2.Load(TKey id) in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\BusinessBase.cs:line 323

at BlogEngine.Core.Providers.XmlBlogProvider.<FillPosts>b__53(String id) in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Providers\XmlProvider\Posts.cs:line 81

at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)

at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()

at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)

at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

at BlogEngine.Core.Providers.XmlBlogProvider.FillPosts() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Providers\XmlProvider\Posts.cs:line 76

at BlogEngine.Core.Post.get_Posts() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Post.cs:line 233

at BlogEngine.Core.Post.get_ApplicablePosts() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Post.cs:line 311

at UserControls.PostList.BindPosts()

at UserControls.PostList.OnLoad(EventArgs e)

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

 

Request information:

Request URL: http://blog.domain.com/default.aspx

Request path: /default.aspx

User host address:

User:

Is authenticated: False

Authentication Type: BlogEngine.NET Custom Identity

Thread account name: Server15\ApplicationPool

 

Thread information:

Thread ID: 3

Thread account name: Server15\ApplicationPool

Is impersonating: False

Stack trace: at System.Xml.XmlTextReaderImpl.Throw(Exception e)

at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)

at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)

at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)

at System.Xml.XmlTextReaderImpl.ReadData()

at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)

at System.Xml.XmlTextReaderImpl.ParseText()

at System.Xml.XmlTextReaderImpl.ParseElementContent()

at System.Xml.XmlTextReaderImpl.Read()

at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)

at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)

at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)

at System.Xml.XmlDocument.Load(XmlReader reader)

at System.Xml.XmlDocument.Load(String filename)

at BlogEngine.Core.Providers.XmlBlogProvider.SelectPost(Guid id) in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Providers\XmlProvider\Posts.cs:line 227

at BlogEngine.Core.Post.DataSelect(Guid id) in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Post.cs:line 1439

at BlogEngine.Core.BusinessBase`2.Load(TKey id) in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\BusinessBase.cs:line 323

at BlogEngine.Core.Providers.XmlBlogProvider.<FillPosts>b__53(String id) in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Providers\XmlProvider\Posts.cs:line 81

at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)

at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()

at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)

at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

at BlogEngine.Core.Providers.XmlBlogProvider.FillPosts() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Providers\XmlProvider\Posts.cs:line 76

at BlogEngine.Core.Post.get_Posts() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Post.cs:line 233

at BlogEngine.Core.Post.get_ApplicablePosts() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Post.cs:line 311

at UserControls.PostList.BindPosts()

at UserControls.PostList.OnLoad(EventArgs e)

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

 

Custom event details:

 

 

 

 

Nov 26, 2012 at 9:23 AM

Yes, in web.config there's "httpModules" section - you can remove or comment out the ReferrerModule entry.

Note that error logs you've attached now are different and not related to the Referrer, I'm afraid.

Thanks

Nov 26, 2012 at 1:14 PM

BTW The error you've reported this time happens because of invalid character, but not in Url.  The invalid characters are in the post. Perhaps exporting the blog to a file, cleaning it up and importing back would help?

Kris