Windows Servers

Quick things to check when you experience high memory levels in ASP.NET

This article describes the quick things to check when you experience high memory in Microsoft ASP.NET. Original product version:   ASP.NETOriginal KB number:   893660 This article will start with some common issues, actions to remedy these issues, and a brief explanation of why these situations can cause problems. ASP.NET Support Voice column In the April 2005 Support Voice column, we inadvertently provided a link to the wrong file. Instead of linking to a download for the Web service, we linked to the XML file returned by the Web service. That link has been corrected. If you’d like to review the article with the correct file attached, see Dynamic page updates using XMLHTTP. What’s considered high memory Obviously, this question depends on volume and activity of specific applications. In general, high memory is when your ASP.NET worker process (Aspnet_wp.exe) or Internet Information Services (IIS) worker process (W3wp.exe) memory is consistently increasing and isn’t returning to a comfortable level. In general terms, a comfortable level would be under 600 MB in the default 2-GB user memory address space. Once the memory level is higher than that comfortable level, we’re doing less than we should be. This behavior may affect other applications that are running on the system. The key is to understand some applications require more memory than others. If you’re exceeding these limits, you may add more memory or add another server to your Web farm (or consider a Web farm). Profiling is also recommended in these cases. It can enable developers to create leaner applications. In this article, we’re looking at a situation where you consistently see memory rise until the server stops performing. Application set up for debugging One reason for high memory that we see here in Support a lot is when you have debugging, tracing, or both enabled for your application. Enabling debugging and tracing is a necessity when you develop your application. By default, when you create your application in Visual Studio .NET, you’ll see the following attribute set in your Web.config file: XML <compilation ... debug="true" /> or XML <trace enabled="true" ... /> Also, when you do a final build of your application, make sure that you do it in Release mode, not Debug mode. Once you’re in production, debugging should no longer be necessary. It can really slow down your performance and eat up your memory. Setting this attribute means you change a few things about how you handle your application. First, batch compile will be disabled, even if it’s set in this compilation element. It means that you create an assembly for every page in your application so that you can break into it. These assemblies can be scattered randomly across your memory space, making it more difficult to find the contiguous space to allocate memory. Second, the executionTimeout attribute (<httpRuntime> Element) is set to a high number, overriding the default of 90 seconds. It’s fine when debugging, because you can’t have the application time out while you patiently step through the code to find your blunders. However, it’s a significant risk in production. It means that if you have a rogue request for whatever reason, it will hold on to a thread and continue any detrimental behavior for days rather than few minutes. Finally, you’ll be creating more files in your Temporary ASP.NET files folder. And the System.Diagnostics.DebuggableAttribute (System.Diagnostics Namespace gets added to all generated code, which can cause performance degradation. If you get nothing else from this article, I do hope you get this information. Leaving debugging enabled is bad. We see this behavior all too often, and it’s so easy to change. Remember it can be set at the page level. Make sure all of your pages aren’t setting it. String concatenation There are applications that build HTML output by using server-side code and by just building one large HTML string to send to the browser. It’s fine, but if you’re building the string by using + and & concatenation, you may not be aware of how many large strings you’re building. For example: C# string mystring = "<html>"; mystring = mystring + "<table><tr><td>"; mystring = mystring + "First Cell"; mystring = mystring + "</td></tr></table>"; mystring = mystring + "</html>"; This code seems harmless enough, but here’s what you’re storing in memory: HTML <html> <html><table><tr><td> <html><table><tr><td>First Cell <html><table><tr><td>First Cell</td></tr></table> <html><table><tr><td>First Cell</td></tr></table></html> You may think that you’re just storing the last line, but you’re storing all of these lines. You can see how it could get out of hand, especially when you’re building a large table, perhaps by looping through a large recordset. If it’s what you’re doing, use our System.Text.StringBuilder class, so that you just store the one large string. See Use Visual C# to improve string concatenation performance .NET Framework Service Pack 1 (SP1) If you aren’t running the .NET Framework SP1 yet, install this SP if you’re experiencing memory issues. I won’t go into great detail, but basically, with SP1 we’re now allocating memory in a much more efficient manner. Basically, we’re allocating 16 MB at a time for large objects rather than 64 MB at a time. We’ve all moved, and we all know that we can pack a lot more into a car or truck if we’re using many small boxes rather than a few large boxes. It’s the idea here. Don’t be afraid to recycle periodically We recycle application pools in IIS every 29 hours by default. The Aspnet_wp.exe process will keep going until you end the task, restart IIS, or restart the computer. This behavior means that this process could be running for months. It’s a good idea for some applications to just restart the worker process every couple of days or so, at a convenient time. Questions to ask The previous were all things that you can fix quickly. However, if you’re experiencing memory issues, ask yourself these questions: Am I using many large objects? More than 85,000 KB are stored in a large object heap. Am I storing objects in Session state? These objects are going to stay in memory for much longer than if you use and dispose them. Am I using
Read more

How to increase an IIS webservice time-out period in Windows 10?RSS

In an IIS (version 10.0) webserivce under Windows 10, you know, the default time-out period is 110 seconds. I was trying to extend the time-out duration to 200 seconds (3 minutes 20 seconds). I got a hyperlink https://stackoverflow.com/questions/2414441/how-to-increase-request-timeout-in-iis/51010915 for a solution to increase the IIS webservice time-out duration, on my Win10 Laptop, but all of the approached failed to make even a second extension! In summary, I have applied the following approaches: 1) Set the “executionTimeout” value to be 200 seconds in the web.config file and a specific .aspx page file in a webservice application. For example, <system.web> <httpRuntime executionTimeout="200" /> </system.web> 2) adjust the server webFarm configuration in the Win10 configuration file %WinDir%\System32\Inetsrv\Config\applicationHost.config For example, <webFarm name="${SERVER_NAME}" enabled="true"> <server address="${SERVER_ADDRESS}" enabled="true"> <applicationRequestRouting httpPort="${SERVER_PORT}" /> </server> <applicationRequestRouting> <protocol timeout="${TIME}" /> </applicationRequestRouting> </webFarm> 3) set the “connection time out” value in IIS “Advance Settings”. The detailed operations are shown below: Open your IIS Go to “Sites” option. Mouse right click. Then open property “Manage Web Site“. Then click on “Advance Settings“. Expand section “Connection Limits“, here you can set your “connection time out“ 4) Run the following Power Shell command: Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site' -filter "system.web/httpRuntime" -name "executionTimeout" -value "00:03:20" 5) Execute the following AppCmd commands: appcmd.exe set config "Default Web Site" -section:system.web/httpRuntime /executionTimeout:"00:03:20"
Read more

Idle Worker Process Page-Out in IIS 8.5

In IIS 8.5, the administrator has the option of suspending an idle worker process rather than terminating it. Compatibility COMPATIBILITY Version Notes IIS 8.5 and later Idle Worker Process Page-Out was introduced in IIS 8.5. IIS 8.0 and earlier Idle Worker Process Page-Out was not supported prior to IIS 8.5. Problem Internet Information Services (IIS) on Windows Server 2012 provides the administrator with the option of timing out a worker process that is idle for a specified period of time. This is a good option for sites that are not accessed very often because it frees up system resources when the site is idle. The disadvantage is that the next time the site is accessed, the user will need to wait for the worker process to start again. Solution In IIS 8.5 and later, the administrator has the option of suspending an idle worker process rather than terminating it. A suspended worker process remains alive but is paged-out to disk, reducing the system resources it consumes. When a user accesses the site again, the worker process wakes up from suspension and is quickly available. When an idle worker process is terminated, the worker process is shut down, and the startup period will be longer when the site is subsequently accessed. Terminating the process is the default behavior, and the same behavior that has been used in previous versions of IIS prior to IIS 8.5. The idleTimeoutAction attribute can be configured either for a single application pool or as a default for all application pools. Step by Step Instructions Configure Idle Worker Process Page-Out for a Single Application Pool Open IIS Manager. Select Applications Pools in the Connections pane, select an application pool in the Application Pool pane, and then click Advanced Settings… in the Actions pane. In the Advanced Settings dialog box, under Process Model, select Suspend for the value of Idle Time-out Action to suspend a worker process when the time-out value is reached, paging it out to disk. Select Terminate to shut down the worker process. Optionally set the Idle Time-out value from the default 20 minutes to a different time period. Click OK. Configure Idle Worker Process Page-Out as a Default for Application Pools Open IIS Manager. Select Applications Pools in the Connections pane, and then click Set Application Pool Defaults… in the Actions pane. In the Application Pool Defaults dialog box, under Process Model, select Suspend for the value of Idle Time-out Action to suspend a worker process when the time-out value is reached, paging it out to disk. Select Terminate to shut down the worker process. Optionally set the Idle Time-out value from the default 20 minutes to a different time period. Click OK. View Resource Use in Suspension You can view suspended worker processes in Task Manager and see that they use very little memory or CPU. Verify Idle Time-out Action Configuration in applicationHost.config The idleTimeoutAction configuration can be entered in two places in the applicationHost.config file: For a single application pool, in the <processModel> child element of the <add> element, which sets the idleTimeoutAction attribute only for that pool. This is what is happening for DefaultAppPool in the screenshot of applicationHost.config file below, in which idleTimeoutAction is set to “Suspend”. For all application pools, in the <processModel> child element of the <applicationPoolDefaults> element, which makes a default setting for all the pools. If idleTimeoutAction is not set for a specific pool, e.g., the .NET v4.5 pool below, the default idleTimeoutAction value is used for that pool, in this case “Terminate”. If idleTimeoutAction is set for a pool, that setting overrides the default. Summary In this guide, you have configured IIS to suspend or terminate worker processes that have been idle for a specified amount of time.  
Read more

How to Enable a 32-bit Application Pool in IIS 7 (Dedicated/VPS)

1.  Once logged into your server, open IIS Manager.  You can do this by clicking your Windows Start button and entering “inetmgr” into the search box.  Then press enter. 2.  On the Connections pane, expand the server node and click “Application Pools.” 3.  Right click on your application pool and select “Advanced Settings…” 4.  Change “Enable 32-bit Application to True.” 5.  Click “OK” to finish.
Read more

How to Open Ports in Windows Firewall?

According to your needs, you can configure Windows Firewall settings to block or open ports. You can follow steps below to open ports in Windows Firewall. 1) On the Start menu, Click ‘Windows Firewall with Advanced Security’. 2) Click the ‘Advanced Settings’ link in the sidebar. 3) On the left, click ‘Inbound Rules’. 4) On the right, under Actions, click the ‘New Rule’ link. Windows Firewall shows you the New Inbound Rule Wizard 5) Select the option marked ‘Port’ and click ‘Next’. 6) Choose TCP or UDP. Unlike most routers, you will need to choose between TCP or UDP to create the rule. Enter in the port range. Make sure the “Specific local ports” option is selected, and then type the ports you need to open into the field. You can open multiple individual ports by separating them with a comma, and you can denote a range of ports by using a dash between the two ends of the range. Click Next to continue.   7) Select ‘Allow the connection’ in the next window and hit ‘Next’. 8) Select the network type as you see fit and click Next. 9) Name the rule something meaningful and click Finish. You have now opened a firewall port in Windows and you can use these same steps to block programs or ports too.  
Read more

Installing Zabbix Agent on Windows

This tutorial will help you install and configure the Zabbix agent on Windows Server. Step 1: Download the agent: https://www.zabbix.com/download_agents/ Step 2: Extract the zip file. Step 3: Make a new directory c:\zabbix\ (or any other path you may find convenient. Step 4: Copy the contents of the bin file and the config file into the new folder you created. I like to merge both the bin and the config folder together. Step5: Open the zabbix_agentd_win.conf file. modify the server= line and add the ip address of the Zabbix server that will monitor this agent. here is my example: Server=66.45.240.98 ServerActive=66.45.240.98 modify the hostname= line and set it to match the name of your server. Hostname=server.somdomain.com Step 6: Next the agent needs to be registered into windows as a service using this command c:\zabbix\zabbix_agentd.exe -c c:\zabbix\zabbix_agentd.win.conf -i Step 7: Now you can go to windows services and start the agent just like any other service. The installation of agent is now complete. Your Zabbix server should now be able to monitor the agent. TIPS: Enable ICMP on windows server firewall in power shell: netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol="icmpv4:8,any" dir=in action=allow Open port 10050 for zabbix agent netsh advfirewall firewall add rule name="Open Port 10050" dir=in action=allow protocol=TCP localport=10050 Monitoring HP SmartArray with Zabbix Agent Download the HP Raid CLI. https://support.hpe.com/hpsc/swd/public/detail?sp4ts.oid=468744&swItemId=MTX_9443e08f9fde4a1989f520b967&swEnvOid=4184#tab2 (the above link maybe out dated. Click on “releases” to see if there are newer versions available.) copy file the agent file into the Zabbix folder https://github.com/asand3r/zbx-hpsmartarray/blob/master/Zbx-HPSmartArray.ps1 add this into zabbix_agentd.win.conf UserParameter=hp.smartarray[*],powershell -NoProfile -NoLogo -File “c:\zabbix\Zbx-HPSmartArray.ps1” $1 $2 $3 $4 restart the service Restart-Service “Zabbix Agent” See if your controller is detected .\Zbx-HPSmartArray.ps1 lld ctrl Check the health of the first drive on contorler 0 .\Zbx-HPSmartArray.ps1 health pd 0 “1I:1:1”
Read more

How to Remote Desktop to Windows

How to Remote Desktop to Windows There are several ways to connect to a remote PC across the internet such as TeamViewer, LogMeIn, GoToMyPC etc. Windows has two built-in tools to access remote PC, they are Remote Desktop Connection and Remote Assistance.  You can connect to another computer using Remote Desktop Connection that is running on windows platform. To access a remote PC via RDP, make sure that both PCs are powered up and that the remote access is enabled to your PC. To enable remote access on your PC, follow the below steps: 1) Power on your PC. 2) Click on Start >> Control panel >> System. 3) Click on the Remote settings link in the left task panel. 4) Select “System Properties” and click on “Remote” tab. 5) Select the radio button “Allow remote connections to this computer”. 6) Click Ok. Follow the below steps to remote desktop to Windows. 1) Open the Start menu and type “Remote Desktop” in the search box and click on “Remote Desktop Connection”. 2) Click on “Show options”.   3) Enter the IP address and username of the target computer and click on the button “Connect”.   4) Enter password of the account you configured in the target computer’s Remote Desktop settings and click on the “OK” button.   You are now logged in to the target computer from your Windows workstation.  
Read more

How to Turn Off/On Windows Firewall

Windows firewall is a Microsoft application which provides firewalling and packet filtering functions., which means it can block harmful programs coming from the internet to your system. Users can add the allowed programs in the firewall. It can also block the unsolicited attempts so that you can secure your system. Enabling or Disabling firewall might make your device more vulnerable to unauthorized access. 1) Open your PC. 2) Click “Start” button. 3) Search for “Apps” and click “Control Panel”. 4) Click on “Windows Firewall”.   5) Click “Turn Windows Firewall on or off”.   6) In the Customize Settings window, Choose the “Turn Off Windows Firewall” radio for disabling the firewall and select the “Turn On Windows Firewall” radio button for enabling the firewall. Click the button “Ok” for update the changes.
Read more

Change RDP port on Windows server

How to Change RDP port on Windows server? Remote Desktop Protocol is a secure network protocol developed by Microsoft which provides a user interface with good graphics to connect to another computer over a network connection. The user needs to install a RDP client software on their local system and the remote computer must run the RDP server software. To provide better security to Windows server, sometimes we need to change the Remote Desktop Protocol (RDP) port from default 3389 to something else. Note that the Remote Desktop connection client for the Mac only supports 3389 port, which is the default port of RDP. And also, when we change the RDP port on a Windows server with firewall protection, make sure that the firewall configured properly to allow access to new port. Let’s discuss about how we can change the Remote desktop port on a Windows Server.   1) Connect to the server via Remote desktop and open “Register Editor” by typing “regedit” command on run dialog box. Click simultaneously on the Windows logo + ‘R’ to open the “Run” dialog box.   2) Locate and then click the following registry subkey from the list: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber   Right click on the “Port number” registry key and choose the option “Modify” Next select “Decimal” option and then type the new port number and click on the “OK” button to save the selection.   3) After making the necessary changes quit the Registry editor and Restart the server.   That’s it! You now know how to change Windows RDP port.
Read more

Modify Hosts File on Windows

The hosts file is used to point a hostname to an IP address. when a domain is searched from a local system, in a DNS lookup the hosts file can help us to assign an IP address for our domain name. When we are building a site locally and to test the same we can use this hosts. Because when we have added a hostname on the hosts file the system will fetch the IP address of the hostname from the hosts file. This feature can help developers to check the website locally even without purchasing the domain name or if the domain is under propagation we can easily utilize this feature. To modify the hosts, we need to add the domain name and the IP address which they are resolving to. For example, if we have  a domain www.example.com and it is not yet pointed, so we can add this to our local system hosts file like xxx.xx.xx.xx www.example.com Where the xxx.xx.xx.xx represent the IP address of the server. after you have added an entry on the hosts file, the system begins to resolve the domain to specified IP address in the hosts. After pointing the domain correctly, you need to remove the entry from the local hosts. Let’s see the steps to add resolving IP address to hosts file. 1) Open the Notepad: The first steps for selecting the notepad are different for version less than windows 8 For Windows 10 and 8 Click/press on the Windows Key >> search for Notepad. For windows 7 and vista Click/press on Start >> All Programs >> Accessories. 2)Right click Notepad and select “Run as administrator” option. 3) Open the following file: c:\Windows\System32\Drivers\etc\hosts from the Notepad.   4) Add the IP address and hostname on to the file.   5) Click File >> Save to save your changes.
Read more
Cart

No products in the cart.