Sunday, June 14, 2009

uuidgen.exe - guid generator

"uuidgen.exe -n2" generate two guids.

Saturday, June 6, 2009

Download details: WMI Administrative Tools

Download details: WMI Administrative Tools

26.4 WMI Tools :: Chapter 26. Scripting with WMI :: Part III: Scripting Active Directory with ADSI, ADO, and WMI :: Active Directory :: Server Administration :: eTutorials.org

26.4 WMI Tools :: Chapter 26. Scripting with WMI :: Part III: Scripting Active Directory with ADSI, ADO, and WMI :: Active Directory :: Server Administration :: eTutorials.org


WMIC

Sesame Script: Getting – or Creating – an Object

Sesame Script: Getting – or Creating – an Object: "If we had used the Get method in this case rather than ExecQuery, Get would have returned the first network drive it encountered and returned an object reference to that drive. If you have more than one network drive you have no way of knowing which will be returned. By using ExecQuery, you return all of them."

Benp's Guide to Stuff : Searching WMI

Benp's Guide to Stuff : Searching WMI

Benp's Guide to Stuff : Listing WMI Namespaces installed on a host

Benp's Guide to Stuff : Listing WMI Namespaces installed on a host

Download details: The WMI Diagnosis Utility

Download details: The WMI Diagnosis Utility

How to list WMI namespaces?

Get-WmiObject -Namespace "root" -Class "__NAMESPACE" | Format-List Name

Creating Sites and Virtual Directories, and Setting Properties Using WMI

Creating Sites and Virtual Directories, and Setting Properties Using WMI

Tuesday, June 2, 2009

Configuring Terminal Services with WMI: Terminal Services

Configuring Terminal Services with WMI: Terminal Services: "To view the Terminal Services Provider classes in Wbemtest.exe
Open Wbemtest.exe

Click Connect.

In Namespace, type root\Cimv2

Click Connect.

Click Open Instance.

In Object Path, type the name of the Terminal Services Provider class (see the table below for the names of the classes.) Click OK.

In Properties, click the name of the property you want to view, and then click Show MOF."

Windows Terminal Services and C#

Windows Terminal Services and C#

Wednesday, May 6, 2009

Monday, April 27, 2009

How does WCF implement per-session service?

In order to correlate all messages from a particular client to a particular instance, WCF needs to be able to identify the client. One way of doing that is to rely on a transport-level session; that is, a continuous connection at the transport level, such as the one maintained by the TCP and IPC protocols. As a result, when using the NetTcpBinding or the NetNamedPipeBinding, WCF associates that connection with the client. The situation is more complex when it comes to the connectionless nature of the HTTP protocol. Conceptually, each message over HTTP reaches the services on a new connection. Consequently, you cannot maintain a transport-level session over the BasicHttpBinding. The WS binding, on the other hand, is capable of emulating a transport-level session by including a logical session ID in the message headers that uniquely identifies the client. In fact, the WSHttpBinding will emulate a transport session whenever security or reliable messaging is enabled.

Because the service instance remains in memory throughout the session, it can maintain state in memory, and the programming model is very much like that of the classic client/server. Consequently, it also suffers from the same scalability and transaction issues as the classic client/server model. A service configured for private sessions cannot typically support more than a few dozen (or perhaps up to a hundred or two) outstanding clients due to the cost associated with each such dedicated service instance.



"http://codeidol.com/csharp/wcf/Instance-Management/Per-Session-Services/"

Saturday, April 25, 2009

Compare transport reliability and message reliability

WCF and other service-oriented technologies make a distinction between transport reliability and message reliability. Transport reliability (such as that offered by TCP/IP) offers point-to-point guaranteed delivery at the network packet level, and also guarantees in-order delivery of the packets. Transport reliability is not resilient to dropped network connections and a variety of other communication problems.

Message reliability, as the name implies, deals with reliability at the message level, independent of how many packets are required to deliver the message. Message reliability provides for end-to-end guaranteed delivery and order of messages, regardless of how many intermediaries are involved and how many network hops are required to deliver the message from the client to the service. Message reliability is based on an industry standard for reliable message-based communication that maintains a session at the transport level and supports retries in case of transport failures such as dropping a wireless connection. It automatically deals with congestion, message buffering, and flow control and can adjust the flow of messages accordingly. Message reliability also deals with connection management, verifying connections and cleaning them up when they are no longer needed.

Message reliability does not guarantee message delivery. All it provides is a guarantee that if the message does not reach its destination, the sender will know about it.

"Programming WCF Services, 2nd Edition"

Thursday, April 23, 2009

Why not use IP affinity and in-process session for V2 portal?

Problem:
A friend proposed using sql server session instead of in-process session for V2 portal. My reason of using in-process session is that I thought IP affinity can resolve web farm issue and in-process session is simpler and faster than SQL server session. After further investigation, I found IP affinity cannot address web farm issue for V2 portal.

The types of IP affinity are described in <>:

“Single— In this mode, requests from new IP addresses are load balanced normally. From then on, the same server handles all requests from a given IP address. If servers are maintaining state information locally, this is a good setting for an intranet. However, Internet clients might seem to be coming from multiple IP addresses because of their service providers' network address translations, so this affinity mode won't work with the Internet.

Class C— In this mode, each range of 253 IP addresses in a Class C range is handled by a single cluster member. This mode largely defeats load balancing (because once a range of IP addresses is associated with a node, it won't ever be load balanced to another node), but it ensures that Internet users will always connect to the server that's maintaining their state information locally.


As you can see, Single mode works intranet but not internet. Therefore, Single mode may work for V1 portal (which uses windows authentication and is deployed in extranet) but not for V2 portal (which uses WLID and is deployed in data center). Class C mode is not really a real load balancing.

Conclusion:
Thus, V2 portal has no other choice than using SQL server session.

Risk/Disadvantage of using SQL server session:
It is safe to assume that out-of-process session is 15-30% slower, depending upon variables such as network speed and the size of the object or objects being serialized. (http://www.eggheadcafe.com/articles/20020302.asp)

What to do to switch to SQL server session:
1. Make the classes used in SessionObject serializable.
2. update the V2 portal installer to support Server sql session.

This is the command to create session related tables in PortalDB instead of the default TempDB.

C:\Windows\Microsoft.NET\Framework\v2.0.50727>
aspnet_regsql.exe -S MachineName\SqlInstanceName –E -d PortalDB -ssadd -sstype c

Monday, March 23, 2009

How to install IIS7 on window server 2008 and enable WCF?

Step 1. Install IIS using below script:

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;IIS-FTPPublishingService;IIS-FTPServer;IIS-FTPManagement;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI

Step 2. Enable WCF activation (Add Feature -> .NET Framework 3.0 Features -> WCF Activation).

How to check whether an XP machine is activated or not?

C:\windows\system32\oobe\msoobe.exe /a

Friday, March 13, 2009

Don't redirect after setting a Session variable (or do it right)

http://weblogs.asp.net/bleroy/archive/2004/08/03/Don_2700_t-redirect-after-setting-a-Session-variable-_2800_or-do-it-right_2900_.aspx

Sunday, March 8, 2009

How to debug javascript in Visual studio?

Step 1. Tools->Internet Options…->Advanced->Disable Script Debugging.

Step 2. In IE, View->Script Debugger, then IE will ask to use Visual studio to debug the javascript for the current page loaded in IE.

Friday, January 23, 2009

Is page refreshing a postback?

Depends.

If the page refreshing is after a postback (e.g. a postback caused by clicking a submit button), then this page refreshing will make IsPostBack=true. Otherwise, this page refreshing will have IsPostBack=false.

Wednesday, January 7, 2009

Back button and "Page expired" page

On one page of my portal, I switch the radio buttons several times and then click Back button of IE, it shows "Page expired" page. When I click Back button multiple times, IE sometimes shows "page expired" page, sometimes shows the page having the radio buttons.

Since my portal uses window live id, ajax, I thought they may be the causes. So I created two sites having the same function but one is WLID enabled and the other isn't. And I also tested with two sites having the same function but one is ajax enabled and the other isn't. My final result is they are NOT the cause of the "page expired" page.

I found some articles online mentioned that the cache need to be enabled to kill the "page expired" page. But my site has already been cache enabled.

Then I have to onion debug. After stripping most of the code, I lock down to the web.config. The web.config has this:



After I remove this setting, "page expire" behavior changed but not disappear totally. I am sure this setting contribute to "page expired" issue because this setting cleary introduce this issue to a test site whose Back button works correctly.

Then I continue to narrow down and find that a custom user control that I borrowed from the previous release also causes "page expired".

By further digging into the custom user control, I found it is the File upload control causing "page expired".

In summary, by this long debugging I found these are the root causes for "page expired" when I clicks Back button:

1. the trace setting in web.config.
2. ASP.NET's File Upload Control.

Thursday, January 1, 2009

ASP.NET Life Cycle

http://msdn.microsoft.com/en-us/library/ms178472.aspx