ELMAH / Server 2008 / IIS 7.5 / MVC 2 : 500 - Internal server error - asp.net-mvc-2

I've been trying to resolve a 404 error received when trying to access ELMAH.axd. The ELMAH email functionality worked, but I could not navigate to the axd. Now, I'm getting 500.22 - Internal server error. Can someone spot the error in my code or suggest some recourse short of disabling ELMAH?
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah"/>
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah"/>
<section name="errorTweet" requirePermission="false" type="Elmah.ErrorTweetSectionHandler, Elmah"/>
</sectionGroup>
<system.web>
<authentication mode="Windows" />
<authorization>
<allow roles="ViewOnly,Admins" />
<deny users="*" />
</authorization>
<elmah>
<security allowRemoteAccess="1" />
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ElmahConnectionString" />
<!-- email configured here -->
</elmah>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah"/>
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
</httpModules>
<httpHandlers>
<add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" >
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</modules>
<location path="elmah.axd">
<system.web>
<authorization>
<deny users="*" />
</authorization>
</system.web>
</location>
And in Global.asax:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
I'm using a database to record ELMAH data.
What am I missing? I've read so many posts and it seems that there is no one right answer, I suppose given the several ways applications and servers can be configured.

The error you are seeing definitely looks like a configuration issue.
HTTP 500.22 - "An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode."
I found this link that provides some details on breaking changes in II7. More details specific to the web.config can be found here.
Do you have the ELMAH handler configured in the system.webSever section of your web.config? If not, I believe adding it should resolve your issue:
<handlers>
<add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</handlers>

All I can see is that:
You are trying to make ELMAH logging errors into a database, but the connection string ElmahConnectionString is not defined anywhere. BTW, you should start trying to use logPath="~/App_Data" instead; if all runs well, then implement the database connection.
deny users = "*" means deny everyone; deny users = "?" means deny unauthenticated users. I guess what you want is the latter.

What mode is your application pool running in (classic or integrated)? I had this problem and found that Elmah started working after I change my app pool to integrated mode.

Related

If I don't specify the hosting model in web.config, what will be the default process in asp.net core 5.0

This is my web.config file, I am getting 500 exception after I have deployed project in azure server, If I remove V2 in modules application runs, but it runs on kestrel not in IIS.
<configuration>
<location path="." inheritInChildApplications="false">
<!--<system.web>
<httpRuntime maxRequestLength="204800" enableVersionHeader="false" />
</system.web>-->
<system.webServer>
<security>
<!--Removes Server header from response-->
<requestFiltering removeServerHeader="true">
<!--200 MB in bytes-->
<requestLimits maxAllowedContentLength="209715200" maxQueryString="10240" />
</requestFiltering>
</security>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<remove name="X-AspNet-Version" />
<remove name="X-Forwarded-Host" />
<remove name="Server" />
</customHeaders>
</httpProtocol>
<handlers>
<remove name="aspNetCore" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Data.WebAPI.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel = "inprocess"/>
</system.webServer>
</location>
</configuration>```

IIS 10 - Windows Authentication - AuthenticationType "unavailable"

I am a web app that I'm trying to get working with Windows Auth. However, no matter what I do, I can't get past a 401.
web.config
<configuration>
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<basicAuthentication enabled="false" />
<windowsAuthentication enabled="true">
<providers>
<clear />
<add value="NTLM" />
</providers>
</windowsAuthentication>
</authentication>
<authorization>
<clear />
<add accessType="Deny" users="?" />
<add accessType="Allow" users="CABLE\mmulhe200" />
</authorization>
</security>
<tracing>
<traceFailedRequests>
<add path="*">
<traceAreas>
<add provider="WWW Server" areas="Authentication,Security,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI,WebSocket" verbosity="Verbose" />
</traceAreas>
<failureDefinitions timeTaken="00:00:00" statusCodes="401.1" />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>
</configuration>
IIS Failed Request Trace Output (Partial)
<failedRequest url="http://dev.windowsauthtest.com:80/"
siteId="3"
appPoolId="windowsAuthTest"
processId="33204"
verb="GET"
authenticationType="NOT_AVAILABLE" activityId="{80000727-0003-F400-B63F-84710C7967BB}"
failureReason="STATUS_CODE"
statusCode="401.1"
triggerStatusCode="401.1"
timeTaken="0"
xmlns:freb="http://schemas.microsoft.com/win/2006/06/iis/freb"
>
The part that concerns me is
authenticationType="NOT_AVAILABLE"
I get prompted to enter my credentials and I enter my NT username/password and it just keeps re-prompting.
Any ideas?

Quartz.net error in web config file

Trying to get quartz to log in ms sql server but getting error in web config file.
</configSections>
<quartz>
<add key="quartz.scheduler.instanceName" value="SchedulingPOC"/>
<add key="quartz.scheduler.instanceId" value="SchedulingPOC"/>
<!-- Configure Thread Pool -->
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />
<!-- Configure Job Store -->
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.dataSource.default.connectionString" value="Server=.\SQLExpress;Database=testDB;Trusted_Connection=True;"/>
<add key="quartz.dataSource.default.provider" value="SqlServer-20" />
</quartz>
Running the application in debug mode of Visual Studio Express for web.
Error message:
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070032
Config Error The configuration section 'quartz' cannot be read because it is missing a section declaration
Config File \?\C:\Users\Anbbb\Desktop\TheProject.Web\web.config
<quartz>
24: <add key="quartz.scheduler.instanceName" value="SchedulingPOC"/>
//The configuration section 'quartz' cannot be read because it is missing a section declaration//
Do you have the "section name" defined in "configSections" ??
<configSections>
<section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
PS
I have a "working" AdoStore example at this post:
Connecting Quartz to MS Sql Server
(One of the answers, not the question)
=======
EDIT
Here is my complete and fully working Quart.Net config, using a SqlServer database.
It ~~assumes~~ you have already created the database.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<quartz>
<add key="quartz.scheduler.instanceName" value="ExampleDefaultQuartzSchedulerFromConfigFileSqlServer"/>
<add key="quartz.scheduler.instanceId" value="instance_one"/>
<add key="quartz.threadPool.threadCount" value="10"/>
<add key="quartz.threadPool.threadPriority" value="Normal"/>
<!--
org.quartz.scheduler.idleWaitTime
Is the amount of time in milliseconds that the scheduler will wait before re-queries for available triggers when the scheduler is otherwise idle. Normally you should not have to 'tune' this parameter, unless you're using XA transactions, and are having problems with delayed firings of triggers that should fire immediately.
It defaults to every 30 seconds until it finds a trigger. Once it finds any triggers, it gets the time of the next trigger to fire and stops checking until then, unless a trigger changes. -->
<add key="quartz.scheduler.idleWaitTime" value ="5000"/>
<!-- Misfire : see http://nurkiewicz.blogspot.com/2012/04/quartz-scheduler-misfire-instructions.html -->
<add key="quartz.jobStore.misfireThreshold" value="60000"/>
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"/>
<add key="quartz.jobStore.tablePrefix" value="QRTZ_"/>
<add key="quartz.jobStore.clustered" value="false"/>
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"/>
<add key="quartz.jobStore.dataSource" value="MySqlServerFullVersion"/>
<!-- connectionStringName -->
<!-- "true" below will result in Couldn't store job: JobDataMap values must be Strings when the 'useProperties' property is set. Key of offending value: myFloatValue
exception. -->
<!-- <add key="quartz.jobStore.useProperties" value="true"/> -->
<add key="quartz.jobStore.useProperties" value="false"/>
<add key="quartz.dataSource.MySqlServerFullVersion.connectionString" value="Server=MyServer\MyInstance;Database=QuartzDB;Trusted_Connection=True;Application Name='quartz_config';"/>
<add key="quartz.dataSource.MySqlServerFullVersion.provider" value="SqlServer-20"/>
</quartz>
</configuration>
This code should work....
NameValueCollection config = (NameValueCollection)ConfigurationManager.GetSection("quartz");
You must change your connection string to an EXISTING database.....that is the Quartz database.....creating using the scripts provided in one of the downloadable projects.
Like this maybe:
https://subversion.assembla.com/svn/pms_michael/database/tables/tables_sqlServer.sql

Issue with configuring web.config to use sql server database

I playing around with the John Papa's HotTowel application. The HotTowel sample uses local codecamper.sdf database and I am trying to configure it to use the database on a sql server 2008 r2. When I run the application, I am getting an error saying "An exception of type 'System.InvalidOperationException' occurred in Breeze.ContextProvider.EF6.dll but was not handled in user code." The error is occurring in the CodeCamperRepository.cs on the line that says "get {return _contextProvider.Metadata()" code. The inner exception says
The connection string 'CodeCamper' in the application's configuration file does not contain the required providerName attribute."
I have the following code in web.config, but I unsure if it is correct:
<configuration>
<configSections>
<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="CodeCamper" connectionString="Data Source=testdb\cmstest; Integrated Security=True; MultipleActiveResultSets=True" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=testdb\cmstest; Integrated Security=True; MultipleActiveResultSets=True" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<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>
</system.webServer>
</configuration>
Are there any other changes I should look at to make HotTowel connect to Sql Server? what is it that breeze doesn't like about the configuration? Appreciate any insight.
thanks Community
np
Just like the inner exception says: you need the providerName attribute. So change your ConnectionStrings section to:
<connectionStrings>
<add name="CodeCamper" connectionString="Data Source=testdb\cmstest; Integrated Security=True; MultipleActiveResultSets=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
Just checking, but do you have the CodeCamper connection reference in your DbContext contstructor?
public CCDbContext()
: base("CodeCamper"){ }

.net site all pages do a 302 redirect with AspxAutoDetectCookieSupport

First let me say that I did see this article:
How to remove AspxAutoDetectCookieSupport
However it seems like it fixes the url issue, but not the 302 AspxAutoDetectCookieSupport issue.
I've also read just about every other article on the web about this issue.
I could really use some help here.
This is my web.config
<sessionState mode="InProc" cookieless="false" timeout="6600" />
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear />
<add connectionStringName="SimpleTickConnection" applicationName="TheaterSales" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="15" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="MySqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<anonymousIdentification enabled="true" cookieless="AutoDetect" cookieProtection="All" cookieRequireSSL="false" cookieSlidingExpiration="true" />
To replicate the issue:
http://web-sniffer.net/
and use your url
alt text http://img28.imageshack.us/img28/8615/issue.gif
Ok, I researched on: anonymousIdentification
I removed
cookieless="AutoDetect"
And now the object moved error went away