サーバーがインストールされているドメインの外部からプログラムで TFS サーバーにアクセスしようとしています。基本的なテスト プログラムは次のようになります。
class Program
{
static void Main(string[] args)
{
Uri tfsUri = new Uri("<serverUri>");
TfsConfigurationServer _ConfigurationServer = TfsConfigurationServerFactory.GetConfigurationServer(tfsUri);
CatalogNode projectCollectionCatalog = _ConfigurationServer.CatalogNode.QueryChildren(new[] { CatalogResourceTypes.ProjectCollection }, false, CatalogQueryOptions.None)[0]; // actual connection tries to happen here
}
}
資格情報が強制された別のバージョン:
class Program
{
static void Main(string[] args)
{
Uri tfsUri = new Uri("<serverURI>");
TfsConfigurationServer _ConfigurationServer = new TfsConfigurationServer(tfsUri, new NetworkCredential("<DifferentKindOfUsernames>", "<Password>"));
CatalogNode projectCollectionCatalog = _ConfigurationServer.CatalogNode.QueryChildren(new[] { CatalogResourceTypes.ProjectCollection }, false, CatalogQueryOptions.None)[0];
}
}
両方の以前のバージョンが混在する別のバージョン:
public class ConnectByImplementingCredentialsProvider : ICredentialsProvider
{
public ICredentials GetCredentials(Uri uri, ICredentials iCredentials)
{
return new NetworkCredential("<DifferentKindOfUsernames>", "<Password>", "<DomainOrNot>");
}
public void NotifyCredentialsAuthenticated(Uri uri)
{
throw new ApplicationException("Unable to authenticate");
}
}
class Program
{
static void Main(string[] args)
{
string _myUri = @"<serverUri>";
ConnectByImplementingCredentialsProvider connect = new ConnectByImplementingCredentialsProvider();
ICredentials iCred = new NetworkCredential("<DifferentKindOfUsernames>", "<Password>", "<DomainOrNot>");
connect.GetCredentials(new Uri(_myUri), iCred);
TfsConfigurationServer configurationServer =
TfsConfigurationServerFactory.GetConfigurationServer(new Uri(_myUri), connect);
configurationServer.EnsureAuthenticated();
}
}
そして、アクティブなディレクトリImpersonatorを持つバージョン:
class Program
{
static void Main(string[] args)
{
using (new Impersonator("<DifferentKindOfUsernames>", "<DomainOrNot>", "<Password>"))
{
Uri tfsUri = new Uri("<serverUri>");
TfsConfigurationServer _ConfigurationServer = TfsConfigurationServerFactory.GetConfigurationServer(tfsUri);
CatalogNode projectCollectionCatalog = _ConfigurationServer.CatalogNode.QueryChildren(new[] { CatalogResourceTypes.ProjectCollection }, false, CatalogQueryOptions.None)[0]; // actual connection tries to happen here
}
}
}
serverURI
http://<servername>:8080/tfs
TFS サーバーで通知 URL として設定されている、またはhttp://<serverip>:8080/tfs
(両方ともホスト ファイルが最新の状態でテスト済み)の形式になっています。このプログラムはドメイン内で動作します。
DifferentKindOfUsernames
「DOMAIN\Username」、「LocallyDuplicatedUsername」、「LOCALMACHINE\Username」のいずれかで、適切なパスワードを使用します。パスワードはドメインとマシンで同じです。
この単純なアクセスはドメイン外では機能せず、次のエラーが発生します:
TF30063: You are not authorized to access <serverUri>
(asp.net Web サイトで同じプロセスを使用して) Web コンテキストで翻訳すると、401 エラーになります。
The remote server returned an error: (401) Unauthorized.
たとえ(これまでにテストされたもの):
- ドメイン部外者のマシンでプログラムを実行するローカルユーザー/パスワードと、TFS への管理者アクセス権を持つ Active Directory アカウントとの間のマッピングがあります (TFS での偽装権限が有効になっている場合でも)。
- here で
BackConnectionNames
説明されているように、ドメインの部外者のマシン名と ip を使用してレジストリ キーを追加します。 - here で説明されているように、ループバック チェックを無効にします。
- ユーザー/ドメインまたはマシン名の組み合わせが異なる Active Directory Impersonator を使用しています。ここで説明されている Active Directory Impersonator 。
- ここで説明されているように、ドメイン部外者サーバーIEセキュリティオプションでTFSサーバーIPをローカルインターネットゾーンに追加しました(信頼できるサイトも試しました)。
ブラウザから serverURI へのアクセスをテストしました。DomainName\User + Password で資格情報を指定すると、URI が機能し、TFS コレクションにアクセスできます。以前に説明した変更の前に、これをテストしました。これまでにテストしたすべてのこと以外に、プログラムによるアクセスとブラウザー アクセスの違いは何でしょうか。