October, 2010

...now browsing by month

 

Find out where your website is blocked

Thursday, October 14th, 2010

Today, I was extremely frustrated that two of the websites I developed and hosted at Godaddy.com were not accessible inside China. Did a trace route (run tracert.exe from command line) from the client’s PC inside China and found that the site was blocked at an IP address that is registered under CNC Group in Beijing China. Then I did more research on Google and discovered that website blocking is quite common in China, and some people pointed me to use a web Ping tool to find out how a Http request to you r website page travels through the Internet. The tool vividly showing the locations across the globe a Ping command travels, and it tabulated the information, including the Name of hub (location), result, IP, and average RRT.

To access this tool, go to http://www.just-ping.com and enter your website address.

Some others recommended going through VPN to access websites without restriction. One commenter recommended using http://www.vpninchina.com/; it costs 3 Euro a month, or 36 Euro a year to use the VPN software.

Mysterious connection error in WCF web service call

Thursday, October 14th, 2010

While working on a WCF Service call to return an e-commerce order object to a web client , I sometimes got this puzzling error inside client code:

“The underlying connection was closed: The connection was closed unexpectedly.”

At the beginning, I thought this must be something to do with Entity connection or some SQL to Entity operations inside the data tier that was built on ASP.Net Entity Framework; but there was nothing to be found there.

Then I searched and visited many web postings, and most of them pointed to configuration problem with WCF service model’s endpoint settings. I even followed some postings and made the corresponding changes; but this dreaded error still lingered. I was about to give up before I realized that the WCF service call was working fine before I added couple of enumerated class members to the DataContract class that is to return. Here was the class that was built into my WCF services layer and to be returned to client when the service method “GetOrder” was called:

 

[DataContract] public class EcommOrder : SalesOrder

{

[DataMember] public int EcommOrderID { get; set; }

[DataMember] public int EcommOrderTypeID { get; set; }

// … more data members

}

//web service method call

public EcommOrder GetOrder(int orerid)

{

EcommOrder returned=new EcommOrder();

//retrieve order from data tier (EF) and populate the object

return returned;

}

On the client side where the service was invoked, the serializable object EcommOrder was fetched good and sound.  Then I added this enum member to the EcommOrder class inside the Service tier:

[DataContract] public enum OrderTypes

{

[EnumMember]

StudentOrder=1,

[EnumMember]

CorporateOrder=2,

//and so on

 

}  and EcommOrder now looks like :

 

[DataContract] public class EcommOrder : SalesOrder

{

[DataMember] public int EcommOrderID { get; set; }

[DataMember] public int EcommOrderTypeID { get; set; }

[DataMember] public OrderTypes EcommOrderType;

// … more data members

}

Then I went back to the client code and call the same service call to return the modified EcommOrder object: Oops, now I got that dreaded and misleading error:

“The underlying connection was closed: The connection was closed unexpectedly.”

To confirm the Enum was the cause, I went back and took out the EcommOrderType enumerated member, then re-called the service, yes, the error again went away.

How wacky was that?