WorkItemStore null reference
Hi,
i checked this forum and other sources, but couldnt find any solution for my problem. I have web service and asp.net 2.0 web to access TFS work item store, so my customers can add issues directly to the TFS. It works fine except one small issue
.
protected void Application_Start(Object sender, EventArgs e)
{
TeamFoundationServer tfsConn = null;
try
{
tfsConn = new TeamFoundationServer(Config.TeamFoundationServer());
}
catch (Exception ex)
{
throw ex;
}
if (tfsConn == null)
throw new Exception("Team Foundation Server Connection was not succesfull!");
Application["tfsConnector"] = tfsConn;
WorkItemStore store = null;
// THIS IS NOT GOOD!!!
int i = 100;
while (store == null) // TODO there must be better way to do this
{
try
{
i--;
store = (WorkItemStore)tfsConn.GetService(typeof(WorkItemStore));
}
catch
{
if (i == 0) throw new Exception("Store connection error!");
}
}
Application["workItemStore"] = store;
}
This is part of my code in global.asax.cs of web service. I know, its totaly WRONG way how to do that, but i didn't find any better way.
store = (WorkItemStore)tfsConn.GetService(typeof(WorkItemStore));
This line is returning NULL for couple times after web service is started. I don't have idea why.
Thanks for any help

