Security Prompt when trying to call a webhttpbinding service method.

i was working with a webhttpbinding service which was being called from Javascript and which inturn calls a wshttpbinding service, and all of a sudden i was getting a login prompt when i was trying to invoke this new method that i created, after a while i found out that the problem, my datacontracts were not updated, it was missing a new field that i added, once i added this new field, the login prompt went away….

Advertisement

Team Foundation Error The cache file C:\Users\Administrator\AppData\Local\Microsoft\Team Foundation\3.0\Cache\VersionControl.config is not valid and cannot be loaded. Please correct or delete the file.

Fired up my VPC and tried connecting to TFS and i run into this error, i thought i need to setup bindings and working folders again….

*****************************************************************************
The cache file C:\Users\Administrator\AppData\Local\Microsoft\Team Foundation\3.0\Cache\VersionControl.config is not valid and cannot be loaded.

Please correct or delete the file.
*****************************************************************************

The solution was simple get a copy the “VersionControl.config” from your fellow dev on the project and replace it, TFS internally stores all the team members source control setting in this file.

Exception: New transaction is not allowed because there are other threads running

this was crazy the solution was found in the following thread

http://stackoverflow.com/questions/2113498/sqlexception-from-entity-framework-new-transaction-is-not-allowed-because-there/3902790#3902790

Reason: we cannot do savechanges while still the reader is open.

//This will fail because we are doing savechanges while the reader is open
xs= Dataservice.GetX().Where(x=>!x.Ideleted)

foreach(x in xs)
{
//do something
Savechanges()
}

//this will succed becasuse we did a tolist(which closed the reader) and then did savechanges

xs= Dataservice.GetX().Where(x=>!x.Ideleted).ToList();

foreach(x in xs)
{
//do something
Savechanges()
}

SQL LEN function

Well, i was having an issue comparing a string retrieved from sql server and user input, the comparsion was always failing, wonder why, after debugging i found that the value in sql server had a space at the end (right), so i fired up ssms and did a LEN() function on the string, the len function result was same as what the user entered, then why was the comparsion failing, after sometime i realized that len function ignores spaces on the right, so then i used the datalength function and it gave me the correct result.

wonder why the LEN function ignores the right white spaces……

Identity Key in Entity Framework

we have a sql table with a composite key , and later on we decided to use, an Identity key so altered the table to include a new identity column (we still kept the composite key), now after re-generating the edmx, the entitycreate method was expecting an ID to be passed, but this was supposed to be autogenerated, did not have enough time to debug the issue, but after searching the net for sometime i found that you have to pass an id (can be any int), to the create method as it complains and the savechanges ovverides it with an appropriate id value, i have a todo on that and hopefully i will update regarding the issue in the future.