HttpApplication.IntegratedModuleList is null - asp.net-mvc-4

I'm having trouble calling CheckUrlAccessForPrincipal(..) in the UrlAuthorizationModule.
It' seems like HttpApplication.IntegratedModuleList is null.
My web.config section around modules looks like
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="InitializationModule" type="EPiServer.Framework.Initialization.InitializationModule, EPiServer.Framework" preCondition="managedHandler" />
<add name="UrlRewriteModule" type="EPiServer.Web.RoutingUrlRewriteModule, EPiServer" preCondition="managedHandler" />
<add name="ShellRoutingModule" type="EPiServer.Shell.Web.Routing.ShellRoutingModule, EPiServer.Shell" />
<add name="BusinessFoundationInitializeModule" preCondition="managedHandler" type="Mediachase.Commerce.Core.Modules.BusinessFoundationInitializeModule, Mediachase.Commerce" />
<add name="ProfileModule" type="EPiServer.Business.Commerce.HttpModules.ProfileModule, EPiServer.Business.Commerce" />
</modules>
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add name="ReportingHttpHandler" preCondition="integratedMode" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
....
</system.webServer>
The problem arose when upgrading from MVC4 to MVC5, and the packages connected to this. I dont know if it has anything specific to do with this.
My nuget packages is
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AuthorizeNet" version="1.8.10" targetFramework="net45" />
<package id="Castle.Core" version="3.3.3" targetFramework="net45" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net45" />
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
<package id="EPiCode.SqlBlobProvider" version="1.4.2" targetFramework="net45" />
<package id="EPiServer.CMS.Core" version="10.3.1" targetFramework="net45" />
<package id="EPiServer.Commerce.Core" version="10.2.2" targetFramework="net45" />
<package id="EPiServer.CommerceManager" version="10.2.2" targetFramework="net45" />
<package id="EPiServer.Framework" version="10.3.1" targetFramework="net45" />
<package id="EPiServer.Logging.Log4Net" version="2.1.0" targetFramework="net45" />
<package id="log4net" version="2.0.3" targetFramework="net45" />
<package id="Lucene.Net" version="3.0.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Providers.Core" version="2.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
<package id="Microsoft.ReportViewer.Common" version="10.0.40219.1" targetFramework="net45" />
<package id="Microsoft.ReportViewer.WebForms" version="10.0.40219.1" targetFramework="net45" />
<package id="Microsoft.Tpl.Dataflow" version="4.5.24" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="SlowCheetah" version="2.5.14" targetFramework="net45" />
<package id="structuremap.web-signed" version="3.1.6.186" targetFramework="net45" />
<package id="structuremap-signed" version="3.1.9.463" targetFramework="net45" />
</packages>
I don't know if it's a web.config thing, but I suspect it.

The problem was, the code ran before the application context had been set.
Had to check if the HttpContext.Current.ApplicationInstance == null

Related

msbuild netcoreapp2 referencing .net framework 4.6.1

My VS2017 upd3 solution includes a .Net core 2.0 project which is referncing another project (classlibrary targeting .net framework 4.6.1) within the same solution.
If i do a build on my local machine the solution get compiled successful.
But the msbuild task on TFS2017 upd2 fails with the following error:
##[error]C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets(87,5): Error : The project "D:\AgentWork\1\s\..\..\..\xyz.csproj" targets ".NETCoreApp,Version=v2.0". Referencing ".NETFramework,Version=v4.6.1" is not possible.
FYI - Translated the error from german to english.
Build Server got "NET CORE 2.0 SDK" and latest "Build Tools" by using "Visual Studio Installer" installed.
Local install
Build Server install
There is no option to install ".net framework 4.6.1 developer tools" for core applications at visual studio build tools installer.
Any suggestions what to do so that the build will succeed.
Core Project File...
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="MongoDB.Driver" Version="2.4.4" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
<PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\someproject.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
Packages.config of someproject.csproj
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.1.1" targetFramework="net451" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.1.2" targetFramework="net451" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net451" />
<package id="MongoDB.Bson" version="2.4.4" targetFramework="net451" />
<package id="MongoDB.Driver" version="2.4.4" targetFramework="net451" />
<package id="MongoDB.Driver.Core" version="2.4.4" targetFramework="net451" />
<package id="NETStandard.Library" version="2.0.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net451" />
<package id="RabbitMQ.Client" version="5.0.1" targetFramework="net451" />
<package id="System.Collections" version="4.3.0" targetFramework="net451" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net451" />
<package id="System.ComponentModel" version="4.3.0" targetFramework="net451" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net451" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net451" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net451" />
<package id="System.Globalization" version="4.3.0" targetFramework="net451" />
<package id="System.IO" version="4.3.0" targetFramework="net451" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net451" requireReinstallation="true" />
<package id="System.Linq" version="4.3.0" targetFramework="net451" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net451" />
<package id="System.Net.Http" version="4.3.2" targetFramework="net451" requireReinstallation="true" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net451" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net451" />
<package id="System.Reflection" version="4.3.0" targetFramework="net451" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net451" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net451" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net451" />
<package id="System.Runtime" version="4.3.0" targetFramework="net451" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net451" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net451" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net451" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net451" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net451" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net451" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net451" />
<package id="System.Threading" version="4.3.0" targetFramework="net451" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net451" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net451" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net451" requireReinstallation="true" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net451" />
</packages>

web Api 2.0 Connection string

My web API, using EF Code first, works in my local system but
when I upload this to a remote server, it doesn't work and gives this error:
An application error occurred on the server. The current custom error
settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could,
however, be viewed by browsers running on the local server machine.
Source File:
d:\HostingSpaces-----.com----.com\wwwroot\Publish-API-V2\web.config
Line: 66
Line 66 is about the connection string. Here is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301879
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings></appSettings>
<system.web>
<compilation targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<clear />
<add value="Default.htm" />
<add value="Default.html" />
<add value="Default.asp" />
<add value="Default.aspx" />
<add value="Default.php" />
<add value="Default.pl" />
<add value="Default.cgi" />
<add value="index.htm" />
<add value="index.html" />
<add value="index.asp" />
<add value="index.aspx" />
<add value="index.php" />
<add value="index.pl" />
<add value="index.cgi" />
<add value="_holding.html" />
</files>
</defaultDocument>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
<connectionStrings>
<add name="AppDBContext" connectionString="Server=185.10.72.64;Database=AppDBContext;Trusted_Connection=False;" providerName="System.Data.SqlClient" />
</connectionStrings>
</system.codedom>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Why do I get this error, and how can I fix it?

Spring.net + Hibernate error while upgrading ASP.NET version to .net 4.5

I am new to new to .Net. I have to upgrade my application from .Net 3.5 to .Net 4.5. This application uses spring.net with nHibernate. I am getting null reference error right on the first page of the application while executing the below command because I am referencing PersonDao and it is not initialized. My question is the object PersonDao should have been initialized based on the webconfig and Dao files mentioned below but its not want to know the reason for the same.
_personDao = (IPersonDao)this.ApplicationContext.GetObject("PersonDao");
I have kept the code as same, as part of upgrade I have just modified the web config files and upgraded the spring.net and nhibernate dlls used. I have tried various permutations and combination in the web config files and in the versions of spring.net and nhiberbate but without any success. Below are the web config files
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.web"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/>
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
<section name="databaseSettings" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>
<system.web.extensions>
<scripting>
<webServices>
<authenticationService enabled="true" requireSSL="true"/>
</webServices>
</scripting>
</system.web.extensions>
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net">
<arg key="configType" value="INLINE"/>
<arg key="configFile" value="~/Config/Log4Net.xml"/>
</factoryAdapter>
</logging>
</common>
<log4net>
<appender name="NHibernateFileLog" type="log4net.Appender.RollingFileAppender">
<file value="Logs/nhibernate.txt"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="100MB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] %-5p %c - %m%n"/>
</layout>
</appender>
<appender name="GeneralLog" type="log4net.Appender.RollingFileAppender">
<file value="Logs/general.txt"/>
<appendToFile value="true"/>
<maximumFileSize value="100MB"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="5"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] %-5p %c - %m%n"/>
</layout>
</appender>
<root>
<level value="ERROR"/>
<appender-ref ref="GeneralLog"/>
</root>
<logger name="SSA.Core" additivity="false">
<level value="ERROR"/>
<appender-ref ref="NHibernateFileLog"/>
</logger>
<logger name="NHibernate" additivity="false">
<level value="ERROR"/>
<appender-ref ref="NHibernateFileLog"/>
</logger>
</log4net>
<spring>
<parsers>
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data"/>
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data"/>
</parsers>
<context>
<resource uri="config://spring/objects"/>
<resource uri="~/Config/Web.xml"/>
<resource uri="~/Config/Dao.xml"/>
<resource uri="~/Config/Services.xml"/>
</context>
</spring>
<appSettings>
<add key="DEFAULT_CLIENT_ID" value="1"/>
<add key="Spring.Data.NHibernate.Support.OpenSessionInViewModule.SessionFactoryObjectName" value="SessionFactory"/>
<add key="hibernate.show_sql" value="true"/>
<add key="hibernate.connection.provider" value ="NHibernate.Connection.DriverConnectionProvider"/>
</appSettings>
<connectionStrings/>
<system.web>
<xhtmlConformance mode="Transitional"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<httpHandlers>
<add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
<add verb="*" path="ContextMonitor.ashx" type="Spring.Web.Support.ContextMonitor, Spring.Web" validate="true"/>
<add verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<remove verb="*" path="*.asmx"/>
</httpHandlers>
<httpModules>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="OpenSessionInView" type="Spring.Data.NHibernate.Support.OpenSessionInViewModule, Spring.Data.NHibernate32"/>
</httpModules>
<httpRuntime maxRequestLength="1048576" executionTimeout="50000"/>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<authentication mode="Forms">
<forms name=".SSACOOKIE" loginUrl="~/Web/Login.aspx" />
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<customErrors mode="Off" defaultRedirect="~/Web/Error.aspx">
</customErrors>
<pages theme="Company" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="ajax" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagPrefix="ajaxtools" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>
<add tagPrefix="spring" namespace="Spring.Web.UI.Controls" assembly="Spring.Web"/>
</controls>
</pages>
</system.web>
<databaseSettings>
<add key="db.server" value="*********"/>
<add key="db.user" value="*********"/>
<add key="db.password" value="*******"/>
<add key="db.schema" value="**********"/>
</databaseSettings>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<!--<modules>
<add name ="Spring" type ="Spring.Context.Support.WebSupportModule, Spring.Web"/>
</modules>
<handlers>
<add name="SpringPageHandler" verb="*" path="*.aspx" type ="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
<add name="SpringContextMonitor" verb="*" path ="ContextMonitor.ashx" type ="Spring.Web.Support.ContextMonitor, Spring.Web"/>
</handlers>-->
</system.webServer>
<runtime>
<assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Spring.Core" publicKeyToken="65E474D141E25E07" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.3.2.40943" newVersion="1.3.2.40943"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Spring.Aop" publicKeyToken="65E474D141E25E07" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.3.2.40943" newVersion="1.3.2.40943"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Spring.Data" publicKeyToken="65E474D141E25E07" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.3.2.40943" newVersion="1.3.2.40943"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database"
xmlns:tx="http://www.springframework.net/tx">
<description>
The SSA object definitions for the Data Access Objects.
</description>
<object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
<property name="ConfigSections" value="databaseSettings"/>
</object>
<!-- Database and NHibernate Configuration -->
<db:provider id="DbProvider"
provider="SqlServer-2.0"
connectionString="Integrated Security=false;Server=${db.server};User ID=${db.user};PWD=${db.password};initial catalog=${db.schema};FailIfMissing=True;"/>
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate32">
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingAssemblies">
<list>
<value>SSA.Core</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="hibernate.default_schema" value="*****"/>
<entry key="hibernate.dialect" value="NHibernate.Dialect.MsSql2008Dialect"/>
<entry key="hibernate.connection.isolation" value="ReadUncommitted"/>
<entry key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
</dictionary>
</property>
<property name="ExposeTransactionAwareSessionFactory" value="true" />
</object>
<tx:attribute-driven />
<object id="transactionManager" type="Spring.Data.TxScopeTransactionManager, Spring.Data.NHibernate32">
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactory" ref="SessionFactory"/>
<property name="NestedTransactionsAllowed" value="true"/>
</object>
<!-- Exception translation object post processor --><!--
<object type="Spring.Dao.Attributes.PersistenceExceptionTranslationPostProcessor, Spring.Data"/>-->
<object id="HibernateTemplate" type="Spring.Data.NHibernate.Generic.HibernateTemplate">
<property name="SessionFactory" ref="SessionFactory" />
<property name="TemplateFlushMode" value="Auto" />
<property name="CacheQueries" value="true" />
</object>
<!-- Data Access Objects -->
<object id="ClientDao" type="SSA.Core.Dao.NHibernate.ClientDao, SSA.Core">
<property name="HibernateTemplate" ref="HibernateTemplate"/>
</object>
<object id="ApplicationDao" type="SSA.Core.Dao.NHibernate.ApplicationDao, SSA.Core">
<property name="HibernateTemplate" ref="HibernateTemplate"/>
</object>
<object id="ApplicationUserDao" type="SSA.Core.Dao.NHibernate.ApplicationUserDao, SSA.Core">
<property name="HibernateTemplate" ref="HibernateTemplate"/>
</object>
<object id="PersonDao" type="SSA.Core.Dao.NHibernate.PersonDao, SSA.Core">
<property name="HibernateTemplate" ref="HibernateTemplate"/>
</object>
.
.
.
.
<object id="CaseDao" type="SSA.Core.Dao.NHibernate.CaseDao, SSA.Core">
<property name="HibernateTemplate" ref="HibernateTemplate"/>
</object>
</objects>
</Dao.XML>
The 'httpHandlers' and 'httpModules' components were not working as expected while migrating from 'IIS 6.0' to 'IIS 7.0 pipeline mode - Integrated' which was causing the problem.

how to solve HTTP Error 500.19 - Internal Server Error?

I have been working on project in MVC4. It was running, but after a while I got the error below. I tried to figure it out and removed those duplicate entity framework entries. But it does not connect with the database. How can I solve this issue?
HTTP Error 500.19 - Internal Server Error
Detailed Error Information:
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x800700b7
Config Error There is a duplicate 'entityFramework' section defined
Config File \\?\C:\Users\Jafar\Desktop\MVC\AcadamicRecycling\BootstrapPager\web.config
Config Source:
8: <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
9: <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
10: </configSections>
// this is the web config file: which I got when I opened config file!
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="EmployeeDb"
connectionString="=;server=SQl" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
// this the web config file which available in my project. I coudn't find the duplicate entity framework there when I opened and checked it.
If you could post your web.config (remove any credential type stuff), that would help.
But the message looks pretty clear. You have a duplicate entity framework section.
The lines it showed you in the error message are the relevant lines it's talking about.
If you go into your web.config, you will probably see two sections that look something like
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
Just remove one of them and try again.

there is no roleManager tag in web.config

I am using Asp.Net with MVC4.
This is my Seed method:
protected override void Seed(eManager.Web.Infrastructure.DepartmentDB context)
{
context.Departments.AddOrUpdate(d => d.Name,
new Department() { Name = "Engineering" },
new Department() { Name = "Sales"},
new Department() { Name = "Shipping"},
new Department() { Name = "Human Resources"});
if (!Roles.RoleExists("Admin"))
{
Roles.CreateRole("Admin");
}
if (Membership.GetUser("Majid") == null)
{
Membership.CreateUser("Majid", "221230");
Roles.AddUserToRole("Majid", "Admin");
}
}
and this is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=eManager.Web;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\eManager.mdf" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
but there is no roleManager tag and when I run update-database command it says that
The Role Manager feature has not been enabled
Can somebody please tell me what I have to do??
If it is not there, why not just add it:
Update:
<roleManager enabled="true">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
I think I have the Solution for it, I know it's late but it'll surely help new learners
This Issue is coming because your Solution doesn't have the correct DLL.
So their is no need for any code pasting,
Just go to your Nuget Packages and
Search for MVCInstaller.MVC4 Package and
Install it.
Make sure you check your Web.Config File again, because it won't overwrite the Lines, Instead it'll Add New Lines. So don't forget to Remove older Ones.
You're Ready to use your Command!