BE on .Net 4 - Error 500.19

Mar 25, 2011 at 10:06 PM

Hi,

I have got the latest source code for BlogEngine, and set it all up to run under .Net 4 in Visual Studio 2010

Everything builds fine, but when I try to run it I get an error:

<fieldset><legend>Detailed Error Information</legend>
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070032
Config Error The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration
Config File \\?\D:\inetpub\wwwroot\BitsAndPictures\web.config
Requested URL http://localhost:80/bitsandpictures/default.aspx
Physical Path D:\inetpub\wwwroot\BitsAndPictures\default.aspx
Logon Method Not yet determined
Logon User Not yet determined
</fieldset>

The Web.config file is as found in the setup folder for .net 4

The system.web.extensions section found in the file is below:

    <system.web.extensions>
        <scripting>
            <webServices>
                <authenticationService enabled="true" requireSSL="false"/>
            </webServices>
        </scripting>
    </system.web.extensions>

Can anybody point me in the right direction here?

Thanks.

Paul

Mar 26, 2011 at 12:12 AM

How is your "Bitsandpictures" directory set up in IIS? And are you sure you have .NET 4 installed and registered? I had to re-register a DLL once even after it was installed.

Mar 26, 2011 at 1:34 AM

BitsAndPictures directory is a directory in wwwroot, which is set as an application, using the ASP.Net 4 threadpool.

.Net 4 is installed OK as far as I can tell, although while I have other .Net 4 projects running quite happily on other machines this is the first one I've tried on here.

Any ideas of where to look would be appreciated.

Thanks

Paul

Mar 28, 2011 at 8:55 AM

OK,

Well I've tried it on another machine, and I'm getting further, but now I get the error shown below.

I've changed the GetCompiledExtensions function in Utils.cs as posted by rtur in another thread.

I now also need to figure out why I can't get this far on my other machine - I have re-installed .Net 4 framework, but no luck. (That machine is running Vista, the one where I get this error is Win 7 x64)

 

Thankyou

 

Paul

 

Server Error in '/BitsAndPictures' Application.

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Source Error:

Line 453:            foreach (Assembly a in codeAssemblies)
Line 454:            {
Line 455:                var types = a.GetTypes();
Line 456:                foreach (var type in types)
Line 457:                {


Source File: D:\Visual Studio 2010 Projects\BlogEngine\BlogEngine\DotNetSlave.BusinessLogic\Web\Extensions\ExtensionManager.cs    Line: 455

Stack Trace:

[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0
   System.Reflection.Assembly.GetTypes() +144
   BlogEngine.Core.Web.Extensions.ExtensionManager.LoadExtensions() in D:\Visual Studio 2010 Projects\BlogEngine\BlogEngine\DotNetSlave.BusinessLogic\Web\Extensions\ExtensionManager.cs:455
   BlogEngine.Core.Web.Extensions.ExtensionManager.ExtensionEnabled(String extensionName) in D:\Visual Studio 2010 Projects\BlogEngine\BlogEngine\DotNetSlave.BusinessLogic\Web\Extensions\ExtensionManager.cs:108
   BlogEngine.Core.Utils.<LoadExtensions>b__20(SortedExtension x) in D:\Visual Studio 2010 Projects\BlogEngine\BlogEngine\DotNetSlave.BusinessLogic\Utils.cs:957
   System.Linq.WhereListIterator`1.MoveNext() +165
   BlogEngine.Core.Utils.LoadExtensions() in D:\Visual Studio 2010 Projects\BlogEngine\BlogEngine\DotNetSlave.BusinessLogic\Utils.cs:957
   ASP.global_asax.Application_Start(Object sender, EventArgs e) in d:\Inetpub\wwwroot\BitsAndPictures\Global.asax:72

[HttpException (0x80004005): Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3988565
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Coordinator
Mar 28, 2011 at 3:18 PM

http://blogengine.codeplex.com/discussions/249371

Mar 28, 2011 at 3:41 PM

Thanks rtur.

Unfortunately I've already done that, as I did some searches before I even tried to build it in .Net 4.0

The error I am getting is occurring in ExtensionManager.cs - even though it would appear to be related.

I've followed the steps in your post here:  http://rtur.net/blog/post/2010/12/22/Using-BlogEngineNET-20-with-NET-40-framework.aspx
but am still experirncing the same thing. I have cleaned the blogengine.core project to make sure it is being rebuilt, and still nothing.

So in a last-gasp effort I have tried removing the reference to Blogengine.core from the web site and re-adding it. That has got rid of the previous error, but I am now getting a different one:

 

Server Error in '/BitsAndPictures' Application.

Could not load file or assembly 'BlogEngine.Core' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'BlogEngine.Core' or one of its dependencies. An attempt was made to load a program with an incorrect format.

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.


Assembly Load Trace: The following information can be helpful to determine why the assembly 'BlogEngine.Core' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Stack Trace:

[BadImageFormatException: Could not load file or assembly 'BlogEngine.Core' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +118

[ConfigurationErrorsException: Could not load file or assembly 'BlogEngine.Core' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11396867
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +484
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +127
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
   System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1087

[HttpException (0x80004005): Could not load file or assembly 'BlogEngine.Core' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

 

Thanks again.

 

Paul

Coordinator
Mar 28, 2011 at 3:55 PM

There is an "update" section in that post you mentioned that deal with this specific error you getting. Also, latest code in repository is .net 4.0 (+ razor) - you can get latest and use it instead.

Mar 28, 2011 at 4:23 PM

Well after downloading the very latest version (I only got the previous one last week) all seems to be working fine.

Thank you very much for your help, and for the continued work on BlogEngine.

Paul