回答済み Problem with the BasicHttpRelayBinding.

  • quarta-feira, 11 de abril de 2012 14:42
     
      Contém Código
    1. I created a new ConsoleApplication.
    2. Changed the Target Framework to ".Net Framework 4"
    3. Install-Package WindowsAzure.ServiceBus
    4. "Successfullt installed "WindowsAzure.ServiceBus 1.6.0.0"
    5. Added the following code to my program class
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.ServiceModel;
    using Microsoft.ServiceBus;
    namespace RelayService
    {
        class Program
        {
            static void Main(string[] args)
            {
                ServiceHost host = new ServiceHost(typeof(ProblemSolver));
                BasicHttpRelayBinding binding = new BasicHttpRelayBinding();
                binding.Security.Mode = EndToEndBasicHttpSecurityMode.Transport;
                ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;
                Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("https", "myNamespace", "solver");
                host.AddServiceEndpoint(
                   typeof(IProblemSolver), binding,
                   serviceUri)
                    .Behaviors.Add(new TransportClientEndpointBehavior
                    {
                        TokenProvider = TokenProvider.CreateSharedSecretTokenProvider("owner", "mySecretToken=")
                    });
                host.Open();
                Console.WriteLine("Press ENTER to close");
                Console.ReadLine();
                host.Close();
            }
        }
        [ServiceContract(Namespace = "http://www.myDomain.se/solver/2012/04")]
        public interface IProblemSolver
        {
            [OperationContract]
            int AddNumbers(int a, int b);
        }
        public interface IProblemSolverChannel : IProblemSolver, IClientChannel { }
        class ProblemSolver : IProblemSolver
        {
            public int AddNumbers(int a, int b)
            {
                Console.WriteLine("AddNumbers: {0} + {1} = {2}", a, b, a + b);
                return a + b;
            }
        }
    }

    If I run this program from my computer att home or from my 3G mobile connection it works fine. At work we have a webproxy and I do not understand why the program stops on the host.open() line. I get no exeption it just stands there. If I hit the break button in Visual Studio and looks like this.  I tried to add the webproxyaddress to the binding with the same result.

     [In a sleep, wait, or join] 
     [External Code] 
    >RelayService.exe!RelayService.Program.Main(string[] args) Line 29 + 0xb bytes C#
     [External Code]

    Why sleep, wait, join?

    I installed Wireshark to see what is happening.

    What I found was one respons that where a little different.

    The one that fails.

    GET http://213.199.183.11/$servicebus/webstream/fda397f6-74e4-41a2-a91e-029014153b0d/ HTTP/1.1
    X-WSCONNECT: oneway
    X-PROCESS-AT: http://schemas.microsoft.com/netservices/2009/05/servicebus/connect/roles/relay
    Host: 213.199.183.11
    Cache-Control: no-store,no-cache
    Pragma: no-cache

    HTTP/1.1 200 OK
    Cache-Control: no-cache
    Content-Type: application/octet-stream
    Server: Microsoft-HTTPAPI/2.0
    Date: Wed, 11 Apr 2012 10:14:54 GMT
    Transfer-Encoding: chunked
    Proxy-Connection: Keep-Alive
    Connection: Keep-Alive
    Age: 5

    800
    ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
    2
    ..
    4
    ....
    2
    ..
    0

    The one that works.

    GET /$servicebus/webstream/aa3965ee-d143-4d36-8b41-c2603a73aca7/ HTTP/1.1
    X-WSCONNECT: oneway
    X-PROCESS-AT: http://schemas.microsoft.com/netservices/2009/05/servicebus/connect/roles/relay
    Host: 213.199.183.10
    Cache-Control: no-store,no-cache
    Pragma: no-cache
    Connection: Keep-Alive

    HTTP/1.1 200 OK
    Cache-Control: no-cache
    Transfer-Encoding: chunked
    Content-Type: application/octet-stream
    Server: Microsoft-HTTPAPI/2.0
    Date: Wed, 11 Apr 2012 10:12:46 GMT

    800
    ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
    2
    ..
    4
    ....
    2
    ..
    4
    ....
    2
    ..
    1


    2
    ..
    11B5
    ........M..O.Y.4.s[......p:.7.....Cg.....z( .....b.-.,..#.....]
    ......Z..(.\./...........W..T...0...0.........
    ^.........0
    ..*.H..
    .....0..1.0..
    ..&...,d....com1.0..
    ..&...,d....microsoft1.0..
    ..&...,d....corp1.0..
    ..&...,d....redmond1*0(..U...!Microsoft Secure Server Authority0..
    100907211250Z.
    120906211250Z0!1.0...U....servicebus.windows.net0.."0
    ..*.H..
    ..........0..
    ............/0....."?b..tl....(.@uf6.@..V..Q.....Z]$.....b..9..^".[.[.z..........yL4V.n.E|...".....X...dr........[..p.......Y.A.;.R.L..C.L3..mJ...*'.d.u.x..T.....O6;.......H,..!E..
    .Q1j..............QRK.....u..g....V..,rB....#....."..7.U..~...(.pl..l.[X..\!.............0...0?..+.....7...200.(+.....7.....M..........}...t.O.........c..d..
    0...U.%..0...+.........+.......0...U........0'..+.....7.
    ..0.0
    ..+.......0
    ..+.......0...U........m..q..%%b..I._....0...U.#..0....B..N.f....@.U|3F..80..
    ..U......0..0.........Xhttp://mscrl.microsoft.com/pki/mscorp/crl/Microsoft%20Secure%20Server%20Authority(8).crl.Vhttp://crl.microsoft.com/pki/mscorp/crl/Microsoft%20Secure%20Server%20Authority(8).crl.Ahttp://corppki/crl/Microsoft%20Secure%20Server%20Authority(8).crl0....+..........0..0^..+.....0..Rhttp://www.microsoft.com/pki/mscorp/Microsoft%20Secure%20Server%20Authority(8).crt0M..+.....0..Ahttp://corppki/aia/Microsoft%20Secure%20Server%20Authority(8).crt0;..U...402..*.servicebus.windows.net..servicebus.windows.net0
    ..*.H..
    ..........v.....nx';...C............H.0...]._....9Va...E../..x..B...".y.....0..1.(k.n..Y].c.&4....{..$U].[bX....`......y.`..f(...)'......z2I..f{.....R.Z.i.......wR.m!.zB!.l.Bs."N..#..*..54..O$...9ZY......|..m
    `....}.5..q.FRRI...
    .j.....C.+.,.....;...o.R.A.....A+.......0...0.........
    a.36.....00
    ..*.H..
    .....0'1%0#..U....Microsoft Internet Authority0..
    100519221330Z.
    140519222330Z0..1.0..
    ..&...,d....com1.0..
    ..&...,d....microsoft1.0..
    ..&...,d....corp1.0..
    ..&...,d....redmond1*0(..U...!Microsoft Secure Server Authority0.."0
    ..*.H..
    ..........0..
    ......._....._.....(...........P".8
    \.q.X-.l..<3c.s.<..y......n$.<Bp._.[.._.'ox...].o..A...C.o_&...7A.Tg...'8....m.155I.F..s....yA....F....S..8..`)..R...S'.A
    @./...I.Zj.Oq..m..'.....+..65@..Mp.p. ....u.+w...jq.ZX..p....mf.0...9..-...x$.....>..k....`..S..................0...0...U.......0.......0...U.......B..N.f....@.U|3F..80...U........0...+.....7.........0#..+.....7......~...Z2..q..Oup......0...+.....7.....
    .S.u.b.C.A0...U.#..0...3!.....D...;3._.K.x]0....U.....0..0.........6http://mscrl.microsoft.com/pki/mscorp/crl/mswww(5).crl.4http://crl.microsoft.com/pki/mscorp/crl/mswww(5).crl..http://corppki/crl/mswww(5).crl0y..+........m0k0<..+.....0..0http://www.microsoft.com/pki/mscorp/mswww(5).crt0+..+.....0...http://corppki/aia/mswww(5).crt0
    ..*.H..
    .............\...w.c.<L|h...J. .?.'=.....H..Y.:..}R..ea.!".h./z........e.].l>.7.t..xU.&....t...v.*j.6..V.. ...0.C.h".jZ.......P.~.Z....N.._lV....T...R\_M....Q..!o.l..*.........W_O.....Q....7X..!.r.....M...TXM+...S.5...Bd.....y.
    8.P..Z./..?}8.. ..N./.Ez.(/1Ho.n\hB.....0..&B8#.....p.h,...s...3#..^...X?P....../b.S.........gk.L.hq@.e;A..I.q..M...G.dB..5..4..(......(Q.q.7..A[|~.,#g..s._@y...0.S...P........Zn....u{...Q.2.X.O..Sj...].S.......)..l...oZ.....E)...C.;.>&...\H.bY4......B....~2.)4..f....>...x..}..:x|.*q..-o.U#......0...0..{........'b.0
    ..*.H..
    .....0u1.0...U....US1.0...U.
    ..GTE Corporation1'0%..U....GTE CyberTrust Solutions, Inc.1#0!..U....GTE CyberTrust Global Root0..
    100414181226Z.
    180414181214Z0'1%0#..U....Microsoft Internet Authority0.."0
    ..*.H..
    ..........0..
    ........'.J.....
    {`.N.....|Pv..J.......+...(...2&.....gh...........'..y...H2.6..k&..C....I...I_....._.*...K~.....]..xV....j.....Y..SZ_...m.}C..tE....|.:4...c...K.#+.i......z. N..HA....)...8..B....-..LW....N._].......d.q...3.8g....6.~.6.~..Z[......}.J/..7..o.[7.....f.#\..........4C{..........
    ,.........I.<.#.D.%...#...UI*.!.}.&..(E...6...KG.......)P.2......S.k...\<..T..'GN<.....F..jE..<.wE./.....<.;.A9. .y..B.>...z7I....$\#.Hn....!)......:l.....M......B$.Oi..h..........md%).4C.[.
    .t.~..c.E.|:.\ks..X...o.......
    ..........w0..s0...U.......0.......0[..U. .T0R0H..+.....>..0;09..+........-http://cybertrust.omniroot.com/repository.cfm0...U. .0...U...........0....U.#...0..y.w0u1.0...U....US1.0...U.
    ..GTE Corporation1'0%..U....GTE CyberTrust Solutions, Inc.1#0!..U....GTE CyberTrust Global Root....0E..U...>0<0:.8.6.4http://www.public-trust.com/cgi-bin/CRL/2018/cdp.crl0...U......3!.....D...;3._.K.x]0
    ..*.H..
    .........+H...D..j.M...N.&...Z...V.o.W.d....5.ce..,.....*..d+I><6l...dg.?.h....<.Q.W.$.5.i.N+.:.....m.y.:..N:nT..Yn...I...u...3.\'..Uq.......
    2
    ;.
    3B
    ..........0....yW^...3..
    up...~....6s..7...5.....vV...muP\'
    2
    %.
    25
    .... ..Z....2\n..eb#..I.6o\.....1..5<
    2
    u.
    175
    ....p..Fv.S.......:...~........s......l.Qb.....1.....S3ju..J..'?...M.+".?.t....1..;....=..l....,U.cE.......7.D..k/...;}.ucta:+!...w.D..}..m..#k<http://213.199.183.11/$servicebus/webstream/fda397f6-74e4-41a2-a91e-029014153b0d/ HTTP/1.1

    And you can se for you self that the respons is much different.

    One other this I do not understand is why it is calling ...$servicebus/webstream... on http. I specified transport security it should be https.

    Is this my webproxy that is messing things upp fore me or am I doning this relayBinding thing wrong?

    /Christer


Todas as Respostas

  • quinta-feira, 12 de abril de 2012 03:20
    Moderador
     
     

    Hi,

    What's kind of web proxy do you have, as far as i know, If developers use ISA proxy, they need ISA client for configure proxy settings. You mentioned that the ServiceBus service works fine at normal network environment, but unavailable in web proxy, so i think the service is OK, and you need do something with your proxy settings.

    Hope this helps.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

  • sexta-feira, 13 de abril de 2012 08:55
     
     Respondido

    I think I figured this out.

    The GET /$servicebus/webstream/aa3965ee-d143-4d36-8b41-c2603a73aca7/ HTTP/1.1 opens upp a "never" ending stream to keep the connection alive. Our proxy/firewall downloads the hole stream before it forwards the traffic. I think that is the reason to my problem.

    The same problem uppears if you try to runing the traffic through Fiddler.

    /Christer