Thursday, March 20, 2008

Localhost and 127.0.0.1 is working but LocalIP is not working

Some problem with your firewall settings. Disable it and try. If its working change your firewall settings accordingly.

Tuesday, March 18, 2008

Windows 2003 Server : Web Service - HTTP Error 404 - File or directory not found

By default, ISS disables dynamic content in Windows 2003 Server. Enable the required extension (In Web Service Extensions node).

Service reference could not be loaded because more than one endpoint configuration for that contract was found

Check your app.config file. Remove the end points which are not required under the client tag.

Monday, March 17, 2008

HTTP POST is not working in webservices hosted remotely

Enable HTTP POST in the web.config file of your webservice.

See http://support.microsoft.com/default.aspx?scid=kb;en-us;819267

Problem after hosting webservice

When I tried to host a WebService and then to check it in the browser I got the content of the file rather than the list of WebMethods.

To solve this, first check whether the asp.net version is set in the website properties in IIS.

If your problem is not solved (most probably you install IIS after installing .net) run "aspnet_regiis.exe -i"(it will be there in your .net frame work folder) and then run "iisreset".

This fixed my problem.

C# : System.Web.UI namespace is missing?

Add a reference to System.Design.

If you are using System.Web.UI.WebControls or System.Web.UI.HtmlControls or etc. you may also need a reference to System.Web.

Friday, March 14, 2008

C# : How to convert an object to xml string?

using System.Xml;
using System.Xml.Serialization;
using System.IO;

public string GetXMLFromObject(object o)
{
XmlSerializer XmlS = new XmlSerializer(o.GetType());

StringWriter sw = new StringWriter();
XmlTextWriter tw = new XmlTextWriter(sw);

XmlS.Serialize(tw, o);
return sw.ToString();
}

Thursday, March 13, 2008

TCP error code 10061: No connection could be made because the target machine actively refused it

The port in which you connected may be blocked by some firewalls. Or you are not listening to a wrong port.

How to debug Windows Media Plugins?

Download 'Dbgview.exe' from Microsoft. Go to 'Capture' menu and enable 'Capture Global Win32'.

Now use 'Debug.WriteLine("The message you need")' in your plugin code. Thats it. Now when you run your plugin the debug messages will be captured by the Dbgview.

Wednesday, March 12, 2008

regasm : No types where registered

When I tried to register a dll file created in C# using regasm I got this Error. You can fix it very easly but setting [assembly: ComVisible(true)] in AssemblyInfo.cs

Visual Studio 2008 - C# : The output path property is not set for this project

Right click the project in the solution explorer and select properties. Select the Build tab and set the Output path.