Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Struggling with Token provider returned "."

$
0
0

Hi,

I have the following code:

    public class Sender
    {
        // get-sbclientconfiguration returned:
        /*
         Endpoint=sb://req150519-vm1.ipoc3.mtc.de/IBAv2SB;StsEndpoint=https://req150519-vm1.ipoc3.mtc.de:9355/IBAv2SB;RuntimePort=9354;ManagementPort=9355
         */

        const string QueueName = "APP-01";          // IsAnonymousAccessible = true
        static string ServiceNamespace = "IBAv2SB";
        static string ServerFQDN = "req150519-vm1.ipoc3.mtc.de";
        static int HttpPort = 9355;
        static int TcpPort = 9354;

        static void Main(string[] args)
        {
            // Identify the URIs required to communicate with Service Bus
            Uri svcUri = new UriBuilder() { Scheme = "https", Host = ServerFQDN, Port = HttpPort, Path = ServiceNamespace }.Uri;
            Uri stsUri = new UriBuilder() { Scheme = "sb", Host = ServerFQDN, Port = HttpPort, Path = ServiceNamespace }.Uri;
            Uri mfUri = new UriBuilder() { Scheme = "sb", Host = ServerFQDN, Path = ServiceNamespace }.Uri;

            var connBuilder = new ServiceBusConnectionStringBuilder();

            connBuilder.ManagementPort = HttpPort;
            connBuilder.RuntimePort = TcpPort;
            connBuilder.Endpoints.Add(svcUri);
            connBuilder.StsEndpoints.Add(stsUri);

            NetworkCredential cred = new NetworkCredential("afservicebussvc@ipoc3.mtc.de", "mtc");  // manageUsersafservicebussvc@ipoc3.mtc.de

            var tokenProvider = TokenProvider.CreateWindowsTokenProvider(new List<Uri>() { stsUri }, cred);

            var fs = new MessagingFactorySettings() { TokenProvider = tokenProvider };

            MessagingFactory factory = MessagingFactory.Create(mfUri, fs);

            var ns = new NamespaceManagerSettings() { TokenProvider = tokenProvider };

            NamespaceManager namespaceManager = new NamespaceManager(svcUri, ns);

            // MessagingFactory factory = MessagingFactory.CreateFromConnectionString(connBuilder.ToString());
            // NamespaceManager namespaceManager = NamespaceManager.CreateFromConnectionString(connBuilder.ToString()

            try
            {
                if (!namespaceManager.QueueExists(Sender.QueueName))
                // PENG:
                    // "The token provider was unable to provide a security token while accessing 'https://req150519-vm1.ipoc3.mtc.de:9355/IBAv2SB/$STS/Windows/'.
                    // Token provider returned message: ''."
                {
                    var qd = new QueueDescription(Sender.QueueName) { EnableBatchedOperations = true, IsAnonymousAccessible = true };
                    namespaceManager.CreateQueue(qd);
                }

                QueueClient myQueueClient = factory.CreateQueueClient(Sender.QueueName);

- autogenerated certs are on the Client machine

- managed user account matches

Any ideas ?

Regards

Torsten

 

Torsten Kuhn


Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>