Build 4926 throws these config errors for XMLBlogProvider

Topics: Business Logic Layer
Sep 30, 2007 at 1:58 AM
This is on the latest build (4926). I noticed this was on build 4814 as well, but then - when I replace just the .DLL with the one I compiled from #4778 it works!?' Any suggestions? Thanks in advance! Details:


Server Error in '/sites/engine' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Exception has been thrown by the target of an invocation.

Source Error:


Line 11: <blogProvider defaultProvider="XmlBlogProvider">
Line 12: <providers>
Line 13: <add name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlBlogProvider"/>
Line 14: </providers>
Line 15: </blogProvider>

Source File: d:\hosting\mikevz\sites\engine\web.config Line: 13

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832


After reload, it shows a new one (and stays that way):

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +59
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +678
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) +113
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +78
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +51
System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) +44
System.Threading.CompressedStack.runTryCode(Object userData) +54
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) +0
System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state) +174
System.Xml.XmlTextReaderImpl.OpenUrl() +199
System.Xml.XmlTextReaderImpl.Read() +50
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +145
System.Xml.XmlDocument.Load(XmlReader reader) +96
System.Xml.XmlDocument.Load(String filename) +157
BlogEngine.Core.Providers.XmlBlogProvider.LoadSettings() +214
BlogEngine.Core.Providers.BlogService.LoadSettings() +39
BlogEngine.Core.BlogSettings.Load() +123
BlogEngine.Core.BlogSettings..ctor() +320
BlogEngine.Core.BlogSettings.get_Instance() +61
BlogEngine.Core.Web.HttpModules.CompressionModule.System.Web.IHttpModule.Init(HttpApplication context) +30
System.Web.HttpApplication.InitModulesCommon() +66
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +814
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +243
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +106
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +340
Coordinator
Sep 30, 2007 at 9:15 AM
You do not have read/write permissions to the app_data folder it seems from looking at the stack trace. That has be applied in Windows.
Sep 30, 2007 at 3:52 PM
How would you explain that only replacing the .DLL from build #4778 does work? Thanks!


madskristensen wrote:
You do not have read/write permissions to the app_data folder it seems from looking at the stack trace. That has be applied in Windows.

Oct 1, 2007 at 4:34 AM
Mads, that error occurs on the 1.2 release as well. The cause seem to be the blogEngine.VirtualPath setting on "/" (with the ~ removed). Whenever I add the tilde again, all works again (yet showing all full AppPaths again). Guess this is a GoDaddy security restriction.
Oct 1, 2007 at 4:53 AM
Mads, just for your information (cause I wouldn't be surprised if I'm the only one running into this ISP/host issue), but I managed to work around this one:

It seems that the ISP (GoDaddy) security policy doesn't allow to access via MapPath from the absolute root (/). Therefore I changed the following from the source:

In line 518 of /BlogEngine.Core/Providers/XMLProvider/XMLBlogProvider.cs I changed this:

#518 string filename = System.Web.HttpContext.Current.Server.MapPath(Utils.RelativeWebRoot + "App_Data/settings.xml");

Into: string filename = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/settings.xml");

That does the trick. There is a typo in the folder path btw: "BlogEngien.Core" but has zero impact.
The only thing that I have to disable via settings is the CSS white space trimming (guess that's caused by the same security policy).

Thanks and congrats with releasing v1.2!