gpt4 book ai didi

tfs - Microsoft.TeamFoundation.WorkItemTracking.Client 中的 InteropServices.COMException

转载 作者:行者123 更新时间:2023-12-05 00:07:50 26 4
gpt4 key购买 nike

我正在尝试通过 WEB API 将工作项提交到 TFS“在线”。它在我的本地机器上工作正常,但是当我将它上传到共享主机服务器时它不工作。

发生了错误。调用 COM 组件返回错误 HRESULT E_FAIL。系统.Runtime.InteropServices.COMException在 Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.DataStoreNative.UpdateMetadata(IntPtr 句柄、对象行集、字符串 dbstamp、UInt32& 更改)在 Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.Datastore.UpdateMetadata(对象行集、字符串 dbstamp) .TeamFoundation.WorkItemTracking.Client.WorkItemStore.EndBackendCall(BackendCallData 数据)在 Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.RefreshCacheInternal(BackendCallData& 数据)在 Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.InitializeInternal() 在 Microsoft.TeamFoundation。 .Client.WorkItemStore.Microsoft.TeamFoundation.Client.ITfsTeamProjectCollectionObject.Initialize(TfsTeamProjectCollection teamProjectCollection) 在 Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.InitializeTeamFoundationObject(String fullName, Object instance) 在 Microsoft.TeamFoundation assembly,AssemblyConnection.Client.Tfs fullName) 在 Mi Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.GetServiceInstance(Type serviceType, Object serviceInstance) 在 Microsoft.TeamFoundation.Client.TfsConnection.GetService(Type serviceType) TeamFoundation.Client.TfsConnection.GetServiceT 位于 FeedBackService.Models.TFSManager.AddWorkItem(字符串标题、字符串描述、字符串图像路径),位于 e:\Industry\InsightSoft\FeedBack\FeedBackService\FeedBackService\Models\TFSManager.cs:第 249 行,位于 FeedBackService。 Controllers.ValuesController.Get() 在 e:\Industry\InsightSoft\FeedBack\FeedBackService\FeedBackService\Controllers\ValuesController.cs:line 28 at lambda_method(Closure , Object , Object[] ) 在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor .ActionExecutor.<>c_DisplayClass13.b_c(Object instance, Object[] methodParameters) 在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor .Execute(Object instance, Object[] arguments) 在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c_DisplayClass5.b_4() 在 System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult ](Func`1 func, CancellationToken cancellationToken)

我的代码:

public void AddWorkItem(string title,string description,string imagePath)
{
string _myUri = "https://testredrock.visualstudio.com/DefaultCollection";

NetworkCredential netCred = new NetworkCredential(userName, password);
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);

TfsClientCredentials credential = new TfsClientCredentials(basicCred);
credential.AllowInteractive = false;

string TFSServerPath = "https://testredrock.visualstudio.com/DefaultCollection";



using (TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(TFSServerPath), credential))
{
CatalogNode catalogNode = tfs.CatalogNode;

ReadOnlyCollection<CatalogNode> tpNodes = catalogNode.QueryChildren(

new Guid[] { CatalogResourceTypes.TeamProject },

false, CatalogQueryOptions.None);

WorkItemStore workItemStore = tfs.GetService<WorkItemStore>();
Project teamProject = workItemStore.Projects[project];
WorkItemType workItemType = teamProject.WorkItemTypes[workitemType];

// Create the work item.
WorkItem userStory = new WorkItem(workItemType)
{
// The title is the only required field that does not have a default value.
// You must set it, or you cannot save the work item.
Title = title,
Description = "",



};

userStory.Fields["Repro Steps"].Value = description;

// Save the new user story.
userStory.Save();

}

}

最佳答案

虽然我正在处理内部 TFS,但我遇到了同样的错误。清除文件在:

C:\ProgramData\Microsoft Team Foundation\4.0\Cache

我从哪里连接到 TFS 为我解决了这个问题。

关于tfs - Microsoft.TeamFoundation.WorkItemTracking.Client 中的 InteropServices.COMException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19394327/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com