如何验证到Visual Studio团队服务,从.NET Windows服务的新的基本身份验证?

编程入门 行业动态 更新时间:2024-10-23 11:28:34
本文介绍了如何验证到Visual Studio团队服务,从.NET Windows服务的新的基本身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图访​​问 visualstudio (原名的 tfs.visualstudio , HTTP: //www.tfspreview )从我的Windows服务写在.NET。

I am trying to access visualstudio (formerly known as tfs.visualstudio, www.tfspreview) from my Windows Service written on .NET.

我要使用的新的基本身份验证,但是我无法找到一个办法做到这一点。

I want to use the new basic authentication but I couldn't find a way to do it.

我发现很多链接到博客帖子的团队基础服务更新 - 8月27日,但它使用的是团队资源管理器到处Java客户端的TFS

I found a lot of links to the blog post Team Foundation Service updates - Aug 27 but it is using the Team Explorer Everywhere Java client for TFS.

有TFS的.NET对象模型的新版本,以支持基本身份验证?

Is there a new version of the TFS .NET Object Model to support the basic authentication?

这是我连续登录时使用的服务帐户的方式。 这个答案很有用的。

By the way I've successively logged in with the service account. This answer was very useful.

推荐答案

首先,你需要有至少的的Visual Studio 2012 Update 1的计算机上安装。它包括与 BasicAuthCredential 类更新 Microsoft.TeamFoundation.Client.dll 组装。

First of all, you need to have at least Visual Studio 2012 Update 1 installed on your machine. It includes an updated Microsoft.TeamFoundation.Client.dll assembly with the BasicAuthCredential class.

下面的代码做到这一点,从的巴克的博客文章如何连接到Team Foundation服务。

Here's the code to do it, from Buck's blog post How to connect to Team Foundation Service.

using System; using System.Net; using Microsoft.TeamFoundation.Client; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { NetworkCredential netCred = new NetworkCredential( "yourbasicauthusername@live", "yourbasicauthpassword"); BasicAuthCredential basicCred = new BasicAuthCredential(netCred); TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred); tfsCred.AllowInteractive = false; TfsTeamProjectCollection tpc = new TfsTeamProjectCollection( new Uri("YourAccountName.visualstudio/DefaultCollection"), tfsCred); tpc.Authenticate(); Console.WriteLine(tpc.InstanceId); } } }

更多推荐

如何验证到Visual Studio团队服务,从.NET Windows服务的新的基本身份验证?

本文发布于:2023-11-14 00:05:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585663.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:身份验证   团队   Studio   Visual   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!