Exceptions while Configuring WCF on Windows 7

Hello All,

Recently I have installed Windows 7 on my machine and was trying to configure all my existing projects. While configuring my Service Project on IIS, I was getting some exceptions. Finally I could manage to configure it. If you are getting exception which says:

HTTP Error 404.3 - Not Found.

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

Or

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

To resolve this you just need to run “%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe -i”
 This will create svc mapping.

Also if anyone is getting Forbidden exceptions, like this:

HTTP Error 403.14 - Forbidden

The Web server is configured to not list the contents of this directory.

Go to IIS, select the Virtual Directory on the left side. Once you select the Virtual directory on right side of that window you will find an option of Directory Browsing. Double click on it and check whether it’s enabled or disable in the Actions List. Click on enable in Action List.

I didn’t not check it on Vista but if you are getting same exceptions then you could try with the same settings. Hope it will work on Vista also.


Please leave your comments to help me improve my blog.

Thank You for visiting the Blog. Happy Coding! :)

Lock wait timeout exceeded; try restarting transaction in MySQL

Today while I was trying to clean up the MySQL Database, I got the following error:
Error Code : 1205
Lock wait timeout exceeded; try restarting transaction
(0 ms taken)

I was surprise to see this error as the same query was working fine before few minutes and then what happen all of sudden. The error came because of some other guy was trying to delete records simultaneously without my knowledge and so the transaction got locked. After doing some Google search I could figure out the solution for it.

Here is what you have to do:

Just run “SHOW INNODB STATUS” in your query browser you will get the status of INNODB which contains LIST OF TRANSACTIONS FOR EACH SESSION. In that just find all the Active thread id’s, say you find one thread id = 148 and then just select and kill that thread id, like this: KILL 148.


That’s all you have to do.

Hope that helps.


Please leave your comments to help me improve my blog.
 
Thank You for visiting the Blog. Happy Coding! :)

How to find Max/Min ID in DataTable

These days I'm working on both ASP.NET and Silvelight. Though I'm working on ASP.NET after a year now, thought posting some of the articles on ASP.NET which I had in my mind but couldnt devote much time. Here is one of them.
How to find the Max/Min ID in DataTable. DataTable has Select Method by which you can get the related records as you do it in SQL or for any database. I'm creating an Employee DataTable which has EmployeeID, FirstName and Lastname columns and fill that with some dummy data.


DataTable objDT = new DataTable();
DataColumn objDC = new DataColumn("EmployeeID", System.Type.GetType("System.Int32"));
objDT.Columns.Add(objDC);
objDC = new DataColumn("FirstName", System.Type.GetType("System.String"));objDT.Columns.Add(objDC);
objDC = new DataColumn("LastName", System.Type.GetType("System.String"));

objDT.Columns.Add(objDC);

DataRow objDR = objDT.NewRow();
objDR["EmployeeID"] = 1;
objDR["FirstName"] = "Lalit";
objDR["LastName"] = "Sharma";
objDT.Rows.Add(objDR);

 
objDR = objDT.NewRow();
objDR["EmployeeID"] = 2;
objDR["FirstName"] = "Aditi";
objDR["LastName"] = "Deodhar";
objDT.Rows.Add(objDR);

objDR = objDT.NewRow();
objDR["EmployeeID"] = 3;
objDR["FirstName"] = "Nimish";
objDR["LastName"] = "Navadkar";
objDT.Rows.Add(objDR);

objDR = objDT.NewRow();
objDR["EmployeeID"] = 4;
objDR["FirstName"] = "Pragati";
objDR["LastName"] = "Dukale";
objDT.Rows.Add(objDR);

objDR = objDT.NewRow();
objDR["EmployeeID"] = 5;
objDR["FirstName"] = "Rumpa";
objDR["LastName"] = "Gune";
objDT.Rows.Add(objDR);

objDR = objDT.NewRow();
objDR["EmployeeID"] = 6;
objDR["FirstName"] = "Abhijit";
objDR["LastName"] = "Parkhi";
objDT.Rows.Add(objDR);

//This is the select query for Max
string selectCommand = "Max(EmployeeID)";

//returns the Max EmploeeID
int nextID = Convert.ToInt32((object)objDT.Compute(selectCommand, string.Empty));
Likewise we can find Min ID in DataTable.
 
Hope that helps.
 
Please leave your comments to help me improve my blog.

Thankyou for visiting the Blog. Happy Coding! :)

How to find DataTable Row Number without ID column.

Hello All,

In ASP.NET one of my favourite topic is playing with DataSet and DataTable. Today one of my colleague asked me "how to find row number of DataTable if we dont have ID column".

Here is a simple way to do it:

int iRowNumber = objDT.Rows.IndexOf(objDT.Select("Name = Varsha")[0]);

iRowNumber will have Row number.

Hope that helps.

Please leave your comments to help me improve my blog.

Thank You for visiting the Blog. Happy Coding! :)