.Net, ASP.Net, C#, VB.net, SQL Server, Xml, CSS, Design Patterns related tips, tricks, code snippets, articles, links, thoughts, etc. from Binu & Subi Thayamkery.

Binu Thayamkery is a seasoned software architect with more than 13 years of experience in developing enterprise grade connected systems using Microsoft Technologies. In his current position as a lead consultant-solution architect with Prudential Financial, he is working on architecture of next generation investment reporting framework using .net 3.5/WCF/AJAX, etc. He holds a Masters Degree in Computer Science from Colorado State University. Subi Thayamkery is an experienced software developer with more than 8 years of developing various application software systems ranging from workflow automation systems to compliance management tools. She currently works as a technology consultant for Prudential Financial where she helps develop a new system for corportate governance department. She holds an Electrical Engineering degree from New Jersey Institute of Technology.

Thursday, May 03, 2007

What is *.VSHost.Exe?

If you are using Visual Studio 2005, when you build your application, you might have noticed a new file named .vshost.exe in your bin directory. This file is a required file for Visual Studio to give some new and improved debugging features. These files are not be deployed and for Visual Studio IDE use only. More information on this can be found here -> http://blogs.msdn.com/dtemp/archive/2004/09/09/215764.aspx

Cheers!

Friday, January 19, 2007

Windows Service - Re-install error in Windows 2000

If you are developing a windows service with .net, when you try to uninstall and re-install your service in a Windows 2000 machine, you might get an error saying "The specified service has been marked for deletion". This is listed as a known issue with Windows 2000 based machines by Microsft.
Trick is to re-start the machine before you try to re-install it.
For more details refer to this Microsoft link: http://support.microsoft.com/kb/823942

Note: To install/uninstall a windows service (developed using .net), you use installutil.exe

Cheers!

Friday, January 05, 2007

Windows Service and .Net

Before .net , writing a windows service (NT Service) used to be a messy C++ job. .Net made writing a
windows service simple and straight forward.

What process is a good candidate to be written as a Windows service?

A long running process or a repeating process that requires no user interaction, no
user interface, not even a console - just sit and do some work kind of process - you write it as a
windows service. Just make sure that you document your service well and publish, so that every one
knows the existence of it. Because for the server ops people, when they take inventory of stuff running
in a server, a custom windows service is not the first one makes the list. This might result in your
service not started after a server re-start and so on.

So it is a good practice to setup your service to start automatically, also if your service does not
require any special permissiona run it under local account. If it requires special permissions like
accessing a file share, create a service account with least required access and run service under that
account...

Next post I will discuss writing a simple service...

Cheers!

Thursday, January 04, 2007

ASP.Net consuming Java WebService - Some observations

1) If your web service is protected by SSL, you are likely to get this error,The underlying connection was closed: Could not establish trust relationship with remote server.
Possible Solution:Add a class that implements ICertificatePolicypublic class PolicySubClass : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint , X509Certificate certificate , WebRequest request , int certificateProblem) {
//Return True to force the certificate to be accepted. return true;
} }
Then in your class code, addSystem.Net.ServicePointManager.CertificatePolicy = new PolicySubClass();
2) If you are accessing your web service via a proxy, you might get this errorThe underlying connection was closed: The server committed an HTTP protocol violation.
If you google this issue, you will find suggestions to fix this in couple of different ways.First approach is to modify web.config to add section like this:


In my case, this did not help, I had to do this in my code, WebProxy proxyObject = new WebProxy("http : // myproxy:10001", true); wsproxy.Proxy = proxyObject;
here, wsproxy is the your web service proxy variable.
3) For many of the connection based errors/issues, many suggest to subclasss your web serviceproxy class to set the HTTP Keep Alive to false
public class ProxySubClass : MyWebServiceProxy { public ProxySubClass(){}
protected override System.Net.WebRequest GetWebRequest(Uri uri) { System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest) base.GetWebRequest(uri); webRequest.KeepAlive = false; return webRequest;
} }

4) As a rule of thumb, when ever there is a connection issue to a web service, start by pasting the web service URL to your web browser address window and try to access the wsdl.If this works, then start trying the above said tweaks!
Cheers!