I have the following web.config page (My site is in ASP.NET 3.5):
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="3.0"/>
<pages validateRequest="false"/>
<httpRuntime requestValidationMode="2.0" />
</system.web>
</configuratiotn>
The problem is that there is an error under the targetFramework and the requestValidationMode.
But I get thie errors:
Unrecognized attribute 'requestValidationMode. Note that names are case-sensitive features.
Unrecognized attribute 'targetFramework. Note that names are case-sensitive features.
My question is how can I fix this error?
requestValidationMode and targetFramework are .NET 4.0+ specific, so you can't use those in an ASP.NET 3.5 project.
Related
I've added IIS Web Sockets into my site recently. To do this I had to add the targetFramework="4.5" into the httpRuntime tag of the web.config.
Unfortunately, now when I try and log in to my site I get the following error:
Decryption key specified has invalid hex characters.
The machineKey in my web.config file is as follows:
<system.web>
<machineKey decryptionKey="513A71A2266CD92E99AA2970F18AE3F8A14DE3625BDD5792FB4AC15F9004693D,IsolateApps" validationKey="FBC9407A7ECE1C60741B44303670247CBE2E08B0658ED1031CF4A2582BDDFA4CD2E27201B083A5DF39C56C2D5B91674BD4FAB2EE644FB067D2C43633D3E6A724,IsolateApps" />
</system.web>
Does anyone know why adding targetFramework would cause this issue, and what I can do to fix it?
After looking further it appears it is the ,IsolateApps that is the issue. Before targetFramework was added, IsolateApps was fine in the machineKey, but with 4.5 added it is seen as no longer valid.
<system.web>
<machineKey decryptionKey="513A71A2266CD92E99AA2970F18AE3F8A14DE3625BDD5792FB4AC15F9004693D" validationKey="FBC9407A7ECE1C60741B44303670247CBE2E08B0658ED1031CF4A2582BDDFA4CD2E27201B083A5DF39C56C2D5B91674BD4FAB2EE644FB067D2C43633D3E6A724" />
</system.web>
I want to change error page for all my websites on IIS.
How can I modify original .net framework error page for all of them at once?
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
I am converting mvc4 project, 4.0 to 4.5
I need to add the folowing line to system.web in web config, but when I do, I get 500 - Internal server error
<httpRuntime targetFramework="4.5" />
Turns out that I was trying to add the httpRuntime, when it already existed at the end of the system.web.
To resolve the issue I did a merge:
<httpRuntime maxRequestLength="102400" executionTimeout="1200" targetFramework="4.5"/>
This is probably a quick question. I'm very new to solution configurations and web.config xml file transformations. I wanted to add a transformation to set the debug attribute for the compilation element of an Asp.Net Mvc website to true:
Web.Debug.config:
<system.web>
<compilation debug="true" xdt:Transform="SetAttributes(debug)" />
</system.web>
Web.config:
<compilation targetFramework="4.0">
<assemblies>
...
</assemblies>
</compilation>
but when I press F5, a window pops up in Visual Studio saying "The page cannot be run in debug mode because debugging is not enabled in the web.config file." It then gives me the option to alter the Web.config file. But I thought the point of the Web.Debug.config file was to allow this to get set automatically... Can I get Visual Studio to use the transformed Web.config file after pressing F5?
Many thanks in advance!
Andrew
Okay, I've decided to use the following setup instead:
Web.config:
<configuration>
...
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
...
</assemblies>
</compilation>
</system.web>
...
</configuration>
Web.Release.config:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation debug="false" xdt:Transform="SetAttributes(debug)" />
</system.web>
</configuration>
This should cause the compilation debug attribute to get overwritten with "false" when the build deployment configuration is set to "release".
From my experience, Transformations do not happen when using the F5 or visual studio debugger. It only does transformations after you publish the website.
Try this
< compilation xdt:Transform="RemoveAttributes(debug)" />
In Visual Studio 2013 if you only have a web.config file, you can right click it and choose "Add Config Transform". By default it contains the
<compilation xdt:Transform="RemoveAttributes(debug)" />
which removes the debug="true".
I've tried wrapping my
<system.web>
with
<location path="." InheritInChildApplications="false">
like this
<location path="." InheritInChildApplications="false">
<system.web>...</system.web>
</location>
But VS 2010 Web Developer Express keeps saying
The 'InheritInChildApplications' attribute is not allowed
When I run my web app there's an error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Config Error Unrecognized attribute 'InheritInChildApplications'.
My configuration: ASP.NET 4.0 RTM, VS 2010, IIS 7.5
It could be because you don't have a namespace specified on the root node? eg
You need
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
not
<configuration>
I think the issue here is that inheritInChildApplications is not a valid attribute of the location node in .net 4.0.
The reason the above fix works is because you are specifically targeting the .net 2.0 configuration schema
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
.net 4.0 privdes a different way of dealing with config inheritance.
See http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx and http://msdn.microsoft.com/en-us/library/ms178692.aspx for more details.
Shouldn't it be a lowercase 'i'?
<location path="." inheritInChildApplications="false">
I have been using it successfully on the last 4 or 5 projects I have worked on. My spec is similar to yours. I'm still using .NET 4 RC. I also include the system.webServer settings within location.
Good luck,
Rich
I use clear quite often to achieve this:
<configuration>
<system.web>
<assemblies>
<clear>
<clientTarget>
<clear>
<compilation>
<compilers>
<clear>
<httpHandlers>
<clear>
<httpModules>
<clear>
<serviceDescriptionFormatExtensionTypes>
<clear>
<webServices>
<protocols>
<clear>
<soapExtensionTypes>
<clear>
<soapExtensionReflectorTypes>
<clear>
<soapExtensionImporterTypes>
<clear>