I have successfully applied IIS Rule (Enforce Lowercase URL) on my website but now I have one issue our one file combres.axd stopped loading.
I tried to apply others way also which I found on stackoverflow but no success yet.
Please advice how to fix this issue.
You could try below rule to change URL into lowercase:
<rule name="LowerCaseRule">
<match url="[A-Z]" ignoreCase="false"/>
<action type="Redirect" url="{ToLower:{URL}}"/>
</rule>
Below is the result:
Failed request tracing result:
If you still face and issue you could run failed request tracing in iis and check why the URL is giving you a 404 error. another thing make sure the file exists at the place with the same path and name.
https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/using-failed-request-tracing-to-trace-rewrite-rules
On my IIS server, I'm getting a warning message logged in the server's Application Event Log on a particular variety of incoming HTTP request with a long URL. Despite the warning message, ASP.NET MVC does correctly handle the request and return the expected response back to the client.
The event log message warning message includes the following text:
Event code: 3005
Event message: An unhandled exception has occurred.
...
Process information:
Process name: w3wp.exe
....
Exception information:
Exception type: HttpException
Exception message: The length of the URL for this request exceeds the configured maxUrlLength value.
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
Additional property/value information for the event log warning message:
Source: ASP.NET 4.0.30319.0
Event ID: 1309
Again, in this case the incoming HTTP request is ultimately succeeding, so unlike similar questions my question here is not how to successfully increase the max URL length for incoming requests on my server.
Rather, my question is: Given that my request is succeeding, can I prevent this (apparently spurious) warning message from being logged to my Application event log (adding noise to the log that may obscure other, "real" warnings)?
More details
This behavior (long HTTP request succeeds; warning message written to application event log) is reproducible both on my local workstation PC running Windows 10 and IIS 10, and on my production server running Windows Server 2008 R2 and IIS 7.5.
The project is being built with target framework: .NET Framework 4.5.1. (Update: The error still reproduces after rebuilding my project to target .NET Framework 4.6.1.)
The URLs that trigger the warning message to be written are long URLs (approximately 500 characters in length) of the form (for example):
https://myserver.example.com:443/api/MyDataRequestRoute/1862241,2146171,1998613,1916341,2150391,2067889,749865,2167130,1861707,1914448,668472,2170269,2162087,2024193,1857969,1869304,2162128,1980539,992479,1347745,1958431,282062,1925128,2147391,2153550,1187318,2039442,441327,1298384,2153556,1526985,1893085,2144727,2144288,1582412,2142540,2170281,1183488,1865249,1348332,1322007,2170282,2170283,1750061,2098502,1915955,905164,1353083,2099151,1347806,2160403,2147200,1191371,1347921,1909967,2017687,2012831
The URL is mapped to an ASP.NET MVC Controller method of the form:
[HttpGet]
[Route("MyDataRequestRoute/{commaSeparatedPropertyIDs}", Name = "MyDataRequestRoute")]
public HttpResponseMessage MyDataRequestRoute(string csv)
{
string xmlResult = // Code to build result based on the specified csv...
return new HttpResponseMessage()
{
Content = new StringContent(xmlResult, Encoding.UTF8, "text/xml")
};
}
In order to get these long URLs working, I previously made a few configuration changes to my application and server, specifically:
Set an UrlSegmentMaxLength value of 32766 in the server's Windows registry, per this answer.
Set attributes of the httpRuntime element in my "Api" project's web.config file:
<httpRuntime targetFramework="4.5" maxRequestLength="131072" maxUrlLength="32766" maxQueryStringLength="32766" />
Set the maxAllowedContentLength attribute of the requestLimits element in the same web.config file:
<requestLimits maxAllowedContentLength="134217728" />
So on local I'm able to upload images fine, but on my deployed website I'm unable to upload images to the media content. I receive an "internal 500 error" with the following path in chrome:
POST http://[url]/umbraco/backoffice/UmbracoApi/Media/PostAddFile?origin=blueimp 500 (Internal)
I looked at umbraco logs and saw this: 2015-12-19 00:15:15,234 [P16524/D8/T73] ERROR Umbraco.Web.WebApi.Filters.FileUploadCleanupFilterAttribute - Could not acquire actionExecutedContext.Response.Content System.NullReferenceException: Object reference not set to an instance of an object. at Umbraco.Web.WebApi.Filters.FileUploadCleanupFilterAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
And on the database table dbo.UmbracoLog when I try to upload it creates a new record: id userId NodeId Datestamp logHeader logComment 1885 0 0 2015-12-19 00:15:15.233 New Media 'IMG_3242.jpg' was created
These failed uploads are the only ones with a NodeId of 0. Not sure if that's strange. Any help would be much appreciated.
I'm using Umbraco v7.3.1.
So I did some digging around on this error and found that it may be a very "un" user-friendly error message. The error is coming up as null reference issue, but the real problem is the ASP.net "default" request size stopping uploading of a large image file. Added the following to the web.config and that resolved the issue:
<system.web>
<httpRuntime maxRequestLength="204800" executionTimeout="99999"/>
</system.web>
On Azure try removing fcnMode="Single" from the httpRuntime node and adding targetFramework="4.5"
I am seeing the following error being returned when I run the StoredProfileAWSCredentials default constructor from within a web application:
System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Path cannot be the empty string or all whitespace.
Parameter name: path
at System.IO.Directory.GetParent(String path)
at Amazon.Runtime.StoredProfileAWSCredentials.DetermineCredentialsFilePath(String profilesLocation) in d:\Jenkins\jobs\build-sdkandtools-release\workspace\sdk\src\AWSSDK_DotNet35\Amazon.Runtime\AWSCredentials.cs:line 354
at Amazon.Runtime.StoredProfileAWSCredentials..ctor(String profileName, String profilesLocation) in d:\Jenkins\jobs\build-sdkandtools-release\workspace\sdk\src\AWSSDK_DotNet35\Amazon.Runtime\AWSCredentials.cs:line 300
at Amazon.Runtime.StoredProfileAWSCredentials..ctor(String profileName) in d:\Jenkins\jobs\build-sdkandtools-release\workspace\sdk\src\AWSSDK_DotNet35\Amazon.Runtime\AWSCredentials.cs:line 270
at Amazon.Runtime.StoredProfileAWSCredentials..ctor() in d:\Jenkins\jobs\build-sdkandtools-release\workspace\sdk\src\AWSSDK_DotNet35\Amazon.Runtime\AWSCredentials.cs:line 260
I am calling this method with no parameters. I have a "default" profile defined which has worked when it has been used. The web application is running under IIS 6.1 in an application pool which uses my credentials (since the AWS credentials were obtained under my login).
I have tried using the two-parameter constructor with the name "default" and the local disk path to the RegisteredAccounts.json file (which was generated for me by the AWS Toolkit extension for VS 2013).
What is happening here and how do I fix it?
You need to set the path in the Web.config file:
<appSettings>
<add key="AWSProfilesLocation" value="path\to\RegisteredAccounts.json" />
<add key="AWSProfileName" value="default"/>
<add key="AWSRegion" value="us-west-2" />
</appSettings>
The credentials file should be in this format:
[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Another option is to include your keys directly in the web/app.config:
<appSettings>
<add key="AWSAccessKey" value="your key" />
<add key="AWSSecretKey" value="your key"/>
</appSettings>
There are more details available in the documentation.
I struggled with the same issue, fortunately the source code is open on GitHub:
https://github.com/aws/aws-sdk-net/tree/master/AWSSDK_DotNet35
When you use the SDK store, it tries to get the path of the RegisteredAccounts.json file with this code:
System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "/AWSToolkit"
In my local environment it pointed to my user profile, something like "C:\Users\MyUser\AppData\Local\AWSToolkit"
But in the server it returned a blank string because I was using the Network User in the app pool, then I changed it for a local user in the server and even so the path was different from the one I've got before:
"C:\Windows\system32\config\systemprofile\AppData\Local\AWSToolkit"
Then I copied the .json file there, but didn't work until I logged in with the new user in the server and with the PowerShell tool of the SDK created a new file with the following command:
Set-AWSCredentials -AccessKey -SecretKey -StoreAs
It created the file in the AppData located in the user folder, then I copied it to the path in system32.
And then it finally worked. Seems too cumbersome, but I really needed the credentials to be encrypted and when you use AWSProfilesLocation you have to store the UserAcessKey and UserSecretKey without any security in a plain text file.
I have an asp.net-mvc site and I have a case where I have a very long querystring in a URL. This was previously not an issue but I am suddenly getting this error in a few cases:
404-File or director not found - the resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
I haven't proven that its due to url length but the reason I am assuming that this is related to length of querystring is that if I selected remove certain parts of the query string it works fine and I have gone through each section (to identify of part of the query string is "corrupt"
I am able to reproduce this error in my example that has a total url length of 2805 characters. Is this expected? I see the issue in both Firefox and Internet Explorer.
The reason I ask is that from my googling, it seems like IIS throws a different error when querystring is too long (415 or 414 error as described here)
Is this something that is set on the server side? in the web.config?
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="xxxx"/>
</requestFiltering>
</security>
</system.webServer>
See
http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits
https://msdn.microsoft.com/en-us/library/e1f13641(v=vs.100).aspx
Per MSDN:
When request filtering blocks an HTTP request because an HTTP request exceeds the request limits, IIS 7 will return an HTTP 404 error to the client and log one of the following HTTP statuses with a unique substatus that identifies the reason that the request was denied:
| HTTP | Substatus Description |
|---------|---------------------------|
| 404.13 | Content Length Too Large |
| 404.14 | URL Too Long |
| 404.15 | Query String Too Long |
FYI - 2048 is generally considered the highest cross-browser limit for a URL length.
It seems like IIS throws a non-standard 404.15 error code for very long query strings. This is probably overshadowed by the default error handler and the actual error is mapped to bare 404 error.
Read this for details:
http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits