Disabling/Removing IIS Shared Configuration

March 1, 2014 Leave a comment

 

If you are using IIS Shared Configuration and changed the password for the account accessing the file path, you might encounter the following error

The World Wide Web Publishing Service service depends on the Windows Process Activation Service service which failed to start because of the following error:
The user name or password is incorrect.

The Windows Process Activation Service service terminated with the following error:
The user name or password is incorrect.

Windows Process Activation Service (WAS) is stopping because it encountered an error. The data field contains the error number.

 

Internet Information Services (IIS) Manager will also start with a weird error message and then prompts you to login

 

All these points to an inability to access the shared configuration

 

How to resolve?

 

  1. Stop IIS (iisreset /stop)
  2. Goto C:\Windows\System32\inetsrv\config
    image
  3. Open redirection.config inside notepad
    image
  4. Change the <configurationRedirection> part to <configurationRedirection />
  5. Start IIS again (iisreset)
Categories: IIS, Windows Server

Windows 8.x–Disable Hibernation and Sleep

January 17, 2014 Leave a comment

To turn off either one, first start an administrator mode command prompt

and then type the required commands

 

#turn off hibernate
powercfg /H off

#disable sleep
powercfg -change -standby-timeout-ac 0

 

image

Categories: General

Commonly used AppFabric cmdlets

January 7, 2014 Leave a comment

Note, all cmdlets must run in administrator mode powershell preferable from the Caching Administration shortcut, else in any normal powershell, run

import-module DistributedCacheAdministration

image

 

An easy way to get all the commands available in the module is to run the following powershell

Get-Command -module DistributedCacheAdministration | Sort-Object > C:\AppFabric.txt

 

Get-AFCacheHostStatus, gets the status of the cache hosts in the cluster

image

 

Get-CacheStatistics [cachename], gets statistics about the cache

image

Get-CacheClusterHealth, gets the health of the Cache Cluster

image

 

Get-CacheHostConfig, gets the host configuration

image

 

Get-CacheConfig [cachename], gets the cache configuration

image

image

 

Setting

Description

CacheName

The name of the cache.

TimeToLive

The default time that items reside in the cache before expiring.

CacheType

The type of cache. This is always Partitioned.

Secondaries

A value of 1 indicates that the cache uses the high availability feature.

IsExpirable

Indicates whether objects in the cache can expire.

EvictionType

Specifies an eviction type of Least-Recently-Used (LRU) or None.

NotificationsEnabled

Indicates whether notifications are enabled for this cache.

Taken from http://msdn.microsoft.com/en-us/library/ff921029(v=azure.10).aspx

Some other useful URLs

http://msdn.microsoft.com/en-us/library/ff921010(v=azure.10).aspx

http://msdn.microsoft.com/en-us/library/ff921023(v=azure.10).aspx

Categories: AppFabric

AppFabric 1.1–Auto Start on computer start up

January 7, 2014 Leave a comment

One of the things about AppFabric is that you cannot run it directly via services

 

image

NEVER and I mean NEVER set this to automatic, you will pay dearly for this

 

The recommended way is to run the Caching Administration Powershell shortcut

image

and then run Start-CacheHost

 

HOWEVER, there is a way for AppFabric to automatically start upon computer start up, what you need to do is to create the following powershell script and save it somewhere, e.g c:\appfabric.ps1

 

import-module DistributedCacheAdministration

$computer = gc env:computername

use-cachecluster

start-cachehost -hostname $computer -cacheport 22233

 

Then add a scheduled task with the following settings

General

image

 

Triggers

image

Actions

image

Program: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Arguments: C:\appfabric.ps1

 

Reboot the computer and watch AppFabric automagically startup on boot, enjoy!

Categories: AppFabric

AppFabric on Windows Server 2012 R2

January 7, 2014 Leave a comment

If you are using Windows Server 2012R2, following the steps in http://wp.me/pBjCs-am will get it working.

HOWEVER if you need cache secondaries i.e

New-Cache Cache1 –Secondaries 1

You will realize that cache redundancy is not working at all, this is because AppFabric is looking for an enterprise version of windows, which is non-existent in Windows Server 2012R2

 

What you need to do is to download AppFabric 1.1 CU 4 found at http://support.microsoft.com/kb/2800726/en-us. This enables the High Availability feature in Windows Server 2012 Standard SKU and above

 

For safety, please down your entire caching service before applying this CU, the CU does attempt to stop the cache host, but always err on the safe side

Categories: AppFabric

HP C7000 Blade Chassis–Remotely unplug and plug in a blade

January 6, 2014 Leave a comment

Sometimes there is a need to remotely unplug and plug in a blade

To do so, ssh into the HP OA ip address then run the following command

reset server <bay>

 

You will then be presented with a prompt similar to below

image

 

And if you enter yes, you should see a message similar to

image

and the bay should disappear from HP Onbard Administrator and reappear again later

Categories: Uncategorized

HTML Entities

December 30, 2013 Leave a comment

As of writing, there are various forms of HTML Encoding

  1. The old school version, e.g &lt, &gt;l&amp;
  2. URL Encoding e.g %20
  3. HTML Entities/HTML Number e.g ! (http://www.ascii.cl/htmlcodes.htm)

However the built in libraries in .NET is only capable of handling #1 and #2

 

For #1 we can either use System.Web.HttpUtility.HtmlDecode or System.Net.WebUtility.HtmlDecode.

 

For #2, we can use the same libraries as #1 but changing it to URLDecode

 

However it seems there is no built in libraries to handle #3. The good news is there is an easy way to do it with the current available libraries in .NET

 

Since all HTML entities are in the format &#[number]; we can use regex to find all of such patterns and replace them with the equivalent character (char)number

 

Sample code of such a function:

static string HtmlDecode(string s)
       {
           var s2 = WebUtility.HtmlDecode(s);
           foreach(Match M in Regex.Matches(s2, @"\&\#(.*?)\;", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline))
           {
               s2 = Regex.Replace(s2, @"\&\#" + M.Groups[1].Value + @"\;", ""+(char)Convert.ToInt64(M.Groups[1].Value), RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline);
           }

           return s2;
       }

Categories: ASP.NET
Follow

Get every new post delivered to your Inbox.