MVC 4 Project IIS executionTimeout not working - c#

IN my server IIS any Request take more than 3 min need to kill
Its lead a problem of server hanging due to high CPU Usage and RAM Memory
<system.web>
<globalization culture="en-US" uiCulture="en-IN" />
<compilation debug="false" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" executionTimeout="180" />
</system.web>
also included in
HttpContext.Server.ScriptTimeout = 60 * 3;

According to your description, if you want to set the connection for a request, I suggest you could try to set the IIS site's advanced setting connection timeout.
More details, you could refer to below steps:
Open IIS Manager, click on the site and go to Manage Web Site -> Advanced Settings.
Under Connection Limits option, you could modify the timeout value.

Related

Windows Authentication not working on Windows Server 2012 R2

I've exhausted every bit of me to get Windows Authentication to work on the server and I cannot find any help on the internet. Windows authentication is working on my local PC, below is what I've done so far, kindly assist me understand if there's something I am missing or did wrong?
Windows Server 2012 R2 (v6.2) with IIS (v8.5.9600)
Here's how my web.config looks like:
<system.web>
<httpRuntime targetFramework="4.5" maxRequestLength="1048576" />
<compilation debug="true" targetFramework="4.5" />
<authentication mode="Windows"/>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
And here's the authentication section in IIS:
I've added the website as a Trusted Site (also as a Local Intranet) in Internet Explorer and that didn't help:
Many threads (including this one here) advised I add 2 entries to the registry to:
Set the DisableStrictNameChecking registry entry to 1
and add my website url in: BackConnectionHostNames
I've done so as per below and still no luck, I've even gone as far as performing the above steps on both the server and my local PC as well:
And I've mirrored everything else on there as is on my local PC. The server was restarted after doing the above 2 steps. The website is configured to use pass-through authentication in IIS and works fine on my local PC:
Is there something I am missing or not doing right? I've carried this problem into my New Year and I am so tired of it. Please anyone help me or point me in the right direction.

Getting error while hosting WCF service when add <trust level="Full" />

I am trying to host WCF service in "hostgator". I want to set Trust level because I am getting security permission error.
When I set Trust Level in web.config, I am getting an error.
web.config:
<location allowOverride="true">
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<identity impersonate="false" />
<authentication mode="None" />
<httpRuntime maxUrlLength="1024" relaxedUrlToFileSystemMapping="true"/>
<customErrors mode="Off"></customErrors>
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
</securityPolicy>
</system.web>
</location>
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.
Can anybody suggest a way to solve this?
enter image description here
Per HostGator FAQ you must run in partial trust using their shared hosting:
No. The applications must be published in Medium Trust in order to run
on the Windows Shared Server.
You're not going to be able to use the SDK in a medium trust environment from what I've read. As Dynamics CRM 2016 expands its support for its REST API that may become an option for you.

Change maximum request length in asp.net mvc without modifying web.config

As the question suggest is it possible to change the maximum request length in an asp.net mvc project without modifying the web.config file?
The project is on several client servers which I don't want to have to manually change for each one so hoping I can put something in global.asax to write it instead or similar?
EDIT:
OR is it possible to add another config file with just the settings I want to overwrite?
I don't think that's possible, as the web config stores the configuration values that your application uses to define how it behaves - in this case, the length of the data you require to be passed on.
You would need to modify the web.config as follows:
<configuration>
<system.web>
<httpRuntime maxRequestLength="1048576" />
</system.web>
</configuration>
And if you are on IIS7 above, the following needs to be configured as well:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
Additional Note: maxAllowedContentLength is measured in bytes while maxRequestLength is measured in kilobytes
Some options you have are:
Powershell script that would read your web.config files on the different servers and update the configuration values accordingly.
Uploading the web config directly via FTP or publish.
Modifying the web config directlyon the server instance.

Uploading files larger than maximum request length [duplicate]

This question already has answers here:
IIS7 - The request filtering module is configured to deny a request that exceeds the request content length
(3 answers)
Closed 7 years ago.
I added a File Upload Control to my website but when I add a large file, I got this error:
The request filtering module is configured to deny a request that exceeds the request content length.
I searched and found a suggested solution was to add this code in the web config
<httpRuntime targetFramework="4.5" maxRequestLength="512000000"/>
and to edit the IIS application host Config and add this code to it
<maxAllowedContentLength="512000000"/>
I made all of these steps and it did not work. I still cannot upload a file larger than the max size.
If you are using IIS6 you need to set the following in your Web.Config (kilobytes and default is 4096 which is 4 MB):
<system.web>
<httpRuntime targetFramework="4.5" maxRequestLength="4096000" />
</system.web>
If you are using IIS7 or later (in bytes and default is 30000000 which is almost 30MB):
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4096000000" />
</requestFiltering>
</security>
</system.webServer>
Make sure you don't add these tags if they already exist. Edit the existing ones otherwise.
Are running on dev machine? IIS Express or Cassini?
Any way thet thing is to set up your web.config.
Try this solution:
<httpRuntime
executionTimeout="90"
maxRequestLength="1024000"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"
enableVersionHeader="true"
/>
http://www.codeproject.com/Articles/10842/Setting-up-Web-config-to-allow-uploading-of-large
be sure that you add this key under <system.web> and also add a attribute "execution time" as below code:
<httpRuntime executionTimeout="10000"maxRequestLength="10240000"maxQueryStringLength="2097151"/>

Validation of viewstate MAC failed, tried generating machine key

Server Error in '/' Application.
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
I've looked through countless of previous questions and I haven't managed to get it working.
I've edited my web.config file and included a generated key at no success.
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>
<system.web>
<machineKey validationKey="E91A16E07A8D628F1F1397962336B0C63B6DC45B8EB3D16BBD5E5761DD8AE462C04C1CC215904FF0353E84EF8194B48682114C72CF8E10F5295E5ADF36DBC520" decryptionKey="EFA118DF00BFB8206F24A1BB4AF7D18FBD6A605B44789E9048D8127FFF950A09" validation="SHA1" decryption="AES" />
<httpRuntime />
<pages enableViewStateMac="true" />
<customErrors mode="Off" />
<compilation targetFramework="4.0" debug="true" />
<authorization>
<allow users="*" />
<deny users="?" />
</authorization>
</system.web>
</configuration>
This happens when I postback to another page!
Instead of using <form action="..."> to perform a cross-page post back, try changing your submit button to read <asp:Button runat="server" postbackurl="...">. Using the PostBackUrl property is the officially supported way to perform a cross-page post back, as it sets a flag in the request telling the destination page to ignore the __VIEWSTATE field.
The main problem lies in the Application Pool of your website.Configure your website to use the proper .NET Framework version (i.e. v4.0) under the General section of the Application Pool related to your website.
Under the Process Model, set the Identity value to Network Service.Close the dialog box and right-click your website and select Advanced Settings... from the Manage Website option of the content menu. In the dialog box, under General section, make sure you have selected the proper name of the Application Pool to be used.
Your website should now run without any problem.Hope this helps you overcome this error.

Categories