When I add FormsAuthentication to ASP.NET MVC2 site in IIS7.5 I get HTTP 403.14 error - asp.net-mvc-2

I have written a custom forms authentication module and when I add it to the web.config of my MVC2 application and run under IIS7.5 I get the HTTP 403.14 error. If I try to navigate to any of the routed Urls then I simply get a 404 error. The annoying thing is that I did all the testing using Cassini with no problems at all. I have applied all of the fixes from all similar issues to no avail. The problem seems to be that with my module registered Mvc Routing stops working. Clearly it would seem to implicate my module but why has it worked all this time using the built-in webserver? Here is the System.x parts of my web.config:
<system.web>
<compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="Ewdev.Gatekeeper.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=02ca582b160d0e09" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms defaultUrl="/" loginUrl="/Authentication/Login" enableCrossAppRedirects="true" name=".GKAUTH" path="/" requireSSL="false" timeout="1440" />
</authentication>
<membership defaultProvider="GatekeeperMembershipProvider" userIsOnlineTimeWindow="120">
<providers>
<clear />
<add name="GatekeeperMembershipProvider" type="Ewdev.Security.MembershipProviders.GatekeeperMembershipProvider, Ewdev.Gatekeeper.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=02ca582b160d0e09" connectionStringName="Ewdev Database" minRequiredPasswordLength="7" minRequiredAlphabeticCharacters="3" minRequiredAlphabeticCaseChanges="1" minRequiredNumericCharacters="1" minRequiredNonAlphanumericCharacters="0" passwordWordsPolicy="true" passwordHistoryPolicy="13" enablePasswordRetrieval="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" minRequiredUserNameLength="6" minRequiredUserNameAlphabeticCharacters="1" minRequiredUserNameNumericCharacters="0" userNameEnableNonAlphanumeric="true" userNameWordsPolicy="true" />
</providers>
</membership>
<customErrors mode="On" />
<pages>
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Linq" />
<add namespace="System.Collections.Generic" />
</namespaces>
</pages>
<trace enabled="false" mostRecent="true" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="true" />
<modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthentication" />
<add name="FormsAuthentication" type="Ewdev.Security.GatekeeperFormsAuthenticationModule" preCondition="" />
</modules>
<handlers>
<remove name="MvcHttpHandler" />
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler" />
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
</system.webServer>
This is all running on my Windows 7 x64 desktop with VS2010, .NET 4 and Mvc2. I have ASP.NET4 installed/registered in IIS. I suspect you will probably want to know what is in the module but the source is rather long so I do not know which bit would be relevant. It is built to the same API specification as the built-in one but apart from redirecting to the Login page when needed there are no other alterations to the request Url and the error appears when trying to display the home page which is open to everyone. I have read that it might be something to do with non-aspx resources such as script, css, image files as modules are set to be applied to all resource types? Other ideas have been along the lines of my module being called after the Url routing module, but I am not convinced about that one, and thirdly that the Global.asax might not be being called? I am in my 3rd day tearing my hair out on this one, mainly because I estimated 1hr to install the website onto IIS... Doh!
Would appreciate any help I can get and quite happy to rewrite my module if only I could work out what bit IIS does not like. Cassini loves it :-(

I have a solution at last! But it was obscure to the extreme and has taken me best part of a week to guess.
I was convinced the problem had something to do with routing and many people were saying that you needed to add the HTTP Redirection special role. I had already added that as well as HTTP Error and Static Content Compression. The solution in the end was to re-install these 3 roles! It would suggest that the order of installing things in the IIS world is very important because I had already set up IIS7.5 before installing MVC2 (via VS2010 install) and even though I had done the other fix many many times (aspnet_regiis -i for ASP.NET 4.0 x86 and x64) this had not fixed the routing issue. Had I installed VS2010 first (with MVC2 included) and then installed IIS7.5 I suspect I would not have had the problem. Except that, believe it or not, a full re-install of IIS7.5 did NOT fix the problem as I had already tried that several days ago. So to recap and include any other necessary configuration the following are the important fixes:
Ensure you have run aspnet_regiis -i
for both Framework/v4... and
Framework64/v4...
Ensure you have allowed ASP.NET v4
for both 32-bit and 64-bit in IIS
(via the IIS Manager, click on the
Server entry in the tree and go to
ISAPI and CGI Restrictions)
Ensure you have HTTP Error and HTTP
Redirection common HTTP IIS special
roles and Static Content Compression
performance IIS special role
installed. And if you have then
un-install and re-install, this is
what eventually fixed the issue for
me.
Please note: This is also the case for IIS7 as I had to do exactly the same procedure on the production Windows 2008 server. I hope that this helps others to a speedy solution. I will probably now lose my contract as I am so far behind because of this problem.
My original web.config turned out to have several uneccessary entries in it, because I was trying any and every solution that people were coming up with, so the following is the System.x parts of my current and working web.config:
<system.web>
<compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="Ewdev.Gatekeeper.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=02ca582b160d0e09" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms defaultUrl="/" loginUrl="/Authentication/Login" enableCrossAppRedirects="true" name=".GKAUTH" path="/" requireSSL="false" timeout="1440" />
</authentication>
<membership defaultProvider="GatekeeperMembershipProvider" userIsOnlineTimeWindow="120">
<providers>
<clear />
<add name="GatekeeperMembershipProvider" type="Ewdev.Security.MembershipProviders.GatekeeperMembershipProvider, Ewdev.Gatekeeper.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=02ca582b160d0e09" connectionStringName="Ewdev Database" minRequiredPasswordLength="7" minRequiredAlphabeticCharacters="3" minRequiredAlphabeticCaseChanges="1" minRequiredNumericCharacters="1" minRequiredNonAlphanumericCharacters="0" passwordWordsPolicy="true" passwordHistoryPolicy="13" enablePasswordRetrieval="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" minRequiredUserNameLength="6" minRequiredUserNameAlphabeticCharacters="1" minRequiredUserNameNumericCharacters="0" userNameEnableNonAlphanumeric="true" userNameWordsPolicy="true" />
</providers>
</membership>
<customErrors mode="On" />
<pages>
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Linq" />
<add namespace="System.Collections.Generic" />
</namespaces>
</pages>
<trace enabled="false" mostRecent="true" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="true" />
<modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthentication" />
<add name="FormsAuthentication" type="Ewdev.Security.GatekeeperFormsAuthenticationModule" />
</modules>
</system.webServer>

I can't add a comment to the users own answer (rating too low?). Anyway, after fighting with my server for a long time trying to resolve the 403.14 messages I stumbled across this question. The steps in the answer fixed the issue for me finally.
I'm guessing the part that worked was the installation of the roles as I had tried everything else suggested here and elsewhere.
Much thanks to the user and stackoverflow :)

My guess is that you set your MvcHttpHandler wrong. The path attribute should be * instead of *.mvc

Related

devexpress xaf database from SQL SERVER to POSTGRESQL

I'm trying to execute the most basic XAF example from devexpress website with PostgreSQL. How can I do it? I've added Entityframework6.Npgsql (from https://www.nuget.org/packages/EntityFramework6.Npgsql/) to sampleErp.Module project and changed the file app.config in project sampleErp.Win. I've also added EntityFramework6.Npgsql to the GAC.
Here is my app.config file:
<?xml version="1.0"?>
<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>
<appSettings>
<add key="Modules" value="" />
<add key="NewVersionServer" value="" />
<add key="EnableDiagnosticActions" value="False" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<connectionStrings>
<add name="EasyTestConnectionString" connectionString="Server=127.0.0.1;User Id=postgres;Password=postgres;Database=mobi03xaf;" providerName="System.Data.EntityClient" />
<add name="ConnectionStringEF" connectionString="Server=127.0.0.1;User Id=postgres;Password=postgres;Database=mobi03xaf;" providerName="System.Data.EntityClient" />
<add name="ConnectionString" connectionString="Server=127.0.0.1;User Id=postgres;Password=postgres;Database=mobi03xaf;" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="Npgsql.NpgsqlConnectionFactory, Npgsql" />
<providers>
<provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, EntityFramework6.Npgsql" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="Npgsql" />
<add name="Npgsql Data Provider"
invariant="Npgsql"
support="FF"
description=".Net Framework Data Provider for Postgresql"
type="Npgsql.NpgsqlFactory, Npgsql" />
</DbProviderFactories>
</system.data>
<system.diagnostics>
<switches>
<add name="eXpressAppFramework" value="3" />
</switches>
</system.diagnostics>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>
I've also installed Npgsql.dll to the GAC by command gacutil /i path\npgsql.dll.
Here is log of the command:
gacutil /l
Npgsql, Version=3.0.7.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL.
But when I try execute project, I'm getting the following error:
InnerException:
Type: InvalidOperationException
Message: The Entity Framework provider type 'Npgsql.NpgsqlServices, EntityFramework6.Npgsql' registered in the application config file for the ADO.NET provider with invariant name 'Npgsql' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
Data: 0 entries
Stack trace:
How can I solve this problem?

How to tell if using EF5

Am taking a Silverlight / WCF RIA Service project from EF4 to EF5. Target is .NET4.5
Here is a spike - am using a DB First approach. ie create edmx, then use the Domain Services Classes Wizard
So looking good so far as have
EntityFramework (5.0.0.0)
Microsoft.ServiceModel.DomainServices.EntityFramework (4.0.0.0) DbDomainService in here
System.Data.Entity (4.0.0.0)
as opposed to old way of:
EntityFramework (5.0.0.0)
System.Data.Entity (4.0.0.0)
System.ServiceModel.DomainServices.EntityFramework (4.0.0.0) LinqToEntitiesDomainService in here
then have put a simple UI on to access the 2 table db and it worked
Problem: This web.config isn't what I expected:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.serviceModel">
<section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<httpModules>
<add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<!-- profile stuff commented out-->
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-BusinessApplication5.Web-20130603151851;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="TestDBEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;initial catalog=TestDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
I was expecting to have to put in:
<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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Got these bits of config from the following. Perhaps they are all codefirst specific.
https://github.com/jeffhandley/riabooks
http://jeffhandley.com/archive/2012/12/10/RIA-Services-NuGet-Package-Updates-ndash-Including-Support-for-EntityFramework.aspx
http://mcasamento.blogspot.co.uk/2012/10/entity-framework-5-code-first-and-wcf.html
The RIA Services dll is compiled against EF 4, not EF5, so the binding Redirect is used to make everything work. If/when RIA Services is open sourced there will be a new release of RiaServices.EntityFramework that will be compiled against EF 5 and EF 6. One of the benefits of open source will be the ability to put out as many NuGet packages as I want to support all combinations.

Orchard, WebForms and iFrames

I am trying to embed an iFrame into a Orchard CMS section (same domain - controls live in a subdirectory off the main Orchard installation). I found two threads on here that talk about the issue I'm having (see here and here), but I'm still running into issues. The pages I am trying to load in the iFrame are standard WebForms and require both WebResource.axd and ScriptResource.axd. I managed to get WebResource.axd working, but ScriptResource is returning a 500 Internal Server Error (according to Chrome), but I can't figure out what's causing the 500 or what the real error is. The relevant entry from my web.config is below - any suggestions?
<handlers accessPolicy="Script">
<!-- clear all handlers, prevents executing code file extensions, prevents returning any file contents -->
<clear />
<!-- Custom Controls -->
<add name="ASPX" path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode" requireAccess="Script"/>
<add name="WebResource" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" preCondition="integratedMode" />
<add name="ScriptResource" path="ScriptResource.axd" verb="GET" type="System.Web.Handlers.ScriptResourceHandler" preCondition="integratedMode" />
<!-- Everything below added from Orchard -->
<!-- Return 404 for all requests via managed handler. The url routing handler will substitute the mvc request handler when routes match. -->
<!--<add name="NotFound" path="*" verb="*" type="System.Web.HttpNotFoundHandler" preCondition="integratedMode" requireAccess="Script" />-->
<!-- WebApi -->
<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>
Combining Bertrand's suggestion and a lot of playing around, I ended up finding a solution to this.
First, the custom stuff will need to be in a subfolder and inside IIS you can switch that subfolder over to an application (not a virtual directory). For a little extra peace of mind, I also gave it a dedicated app pool so if something did get weird with it the main site wouldn't go down.
The next parts involve a couple of steps - mostly because of that <clear /> entry in system.webServer/handlers. Removing this in the parent app breaks Orchard, but having it in broke my child app since it inherits all the settings from the parent. To get around this, my child app had to have the following system.webServer configuration:
<system.webServer>
<handlers>
<remove name="NotFound" />
<add name="ASPX" path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode" requireAccess="Script"/>
<add name="WebResource" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" preCondition="integratedMode" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<modules>
<remove name="WarmupHttpModule" />
</modules>
</system.webServer>
I used the SO link referenced here to find the "real" ScriptResource.axd reference that was needed and it looks like everything is working.

Microsoft Reporting v.10 load problem

I am trying to reference microsoft reporting v.10.0.0.0 in my vs studio web site. For some reason it can't achieve that as it is always giving me a compile error that it could not load the type.
Error 2625 Could not load type 'Microsoft.Reporting.RdlBuildProvider' from assembly 'Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
One thing that I think it might be a cause is that I had moved from 9.0.0.0 to 10.0.0.0 and after that it does not work.
Any suggestions?
Thanks a lot!
After replacing all ofthe references from version 8 or 9 to 10 (in webconfig and also in your asp.net pages. In web.Config file you have to change the following line from
<compilation debug="true">
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
to
<compilation debug="true">
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
Update
You also have to update all of the other reference Number from 9.0.0 to 10.0.0
RdlBuildProvider has been moved to Webforms in version 10, which used to be in common earlier
Adding this to provide a complete answer.
Notice that the key token is the same for v8 and v10. Also, as Madhu said, note that Microsoft.Reporting.RdlBuildProvider has been moved from Common to Webforms as shown in the buildProviders section.
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.ProcessingObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Webforms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</buildProviders>
This solved my issue:
http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/thread/8287e1cd-767e-463c-8cb0-60c275fe5ed6

Which areas of the web.config can i safely delete?

When beginning a new web project, i'm always a bit worried about removing pieces of the web.config. It seems there are more entries than ever with Net 3.5 SP1.
Which bits of the .config do you delete for the following scenarios:
WCF Web Service, no Javascript support
Simple MVC Website
EDIT
Can someone document a basic list of things left in and taken out of the web.config for a simple website?
I usually just delete items from the web.config until things break -- a process of trial and error.
It's astonishing how much of web.config you can remove without affecting anything. It's gotten quite crufty in .NET 3.5.
Largely agree with Jeff that it is a process of trial and error as to what you can remove from the file.
In terms of tweaking the runtime and the http pipeline, it can often be a process of adding things to the web.config, in order to turn things off.
The out of the box configuration adds a lot of modules to the pipeline, depending on what you are doing, you may not need half of them.
Have come across a few articles on this on MSDN, and also this one http://www.codeproject.com/KB/aspnet/10ASPNetPerformance.aspx, by Omar from PageFlakes, which was the only one I could find in my (poorly organised) bookmarks, which is a good starting point on optimising the runtime.
Here is a stripped down Web.config i use for a simple WCF service
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<authentication mode="Windows" />
<customErrors mode="RemoteOnly" defaultRedirect="error.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<system.serviceModel>
<services>
<service behaviorConfiguration="Service.ServiceBehavior" name="Service.Service">
<endpoint address="" binding="basicHttpBinding" contract="Service.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Service.ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
I removed a lot of extras especially the script modules which i won't require