none
WCF net.tcp psi consume sample RRS feed

  • Question

  • Could you show how would I consume a PSI wcf service via code and the net.tcp protocol as for something like:

    consts
    tring svcRouter = "/PSI/ProjectServer.svc";
    const string PWA = @"net.tcp://ProjectServer:32845/pwa/_vti_bin";
    NetTcpBinding binding = null;
    binding =
    new NetTcpBinding();
    binding.Security.Mode =
    SecurityMode.Transport;
    binding.Security.Transport.ClientCredentialType =
    TcpClientCredentialType.Windows;

    EndpointAddress
    address = new EndpointAddress(PWA + svcRouter);
    projectClient =
    new backendProject.ProjectClient(binding, address);
    projectClient.ChannelFactory.Credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.
    TokenImpersonationLevel.Impersonation;
    projectClient.ChannelFactory.Credentials.Windows.AllowNtlm =
    true;

    aric katz
    Friday, March 12, 2010 5:25 PM

Answers

  • Hi Aric,

     I see a couple of issues with your code snippet. First of all, you should not be using TCP. We will not support TCP at runtime as a means of transport. Secondly, you should be targeting the router (ProjectServer.svc) directly and let the router do it's job. The URL for the router should look something like this:

    "http://ProjectServer/pwa/_vti_bin/PSI/ProjectServer.svc" -- alternatively a port number if you are not running your front-end off port 80.

    Another note is that you will use the same URL (that is http://ProjectServer/pwa/_vti_bin/PSI/ProjectServer.svc) regardless of what business object you are targeting. So, if you are using proxies, you have the Url property on the proxy and if you are using the interfaces directly (via ChannelFactory and CreateChannel) you pass the Url as the EndpointAddress argument.

    Hope this helps!

    Thanks,
    Boaz Lev
    MSFT
    Monday, March 15, 2010 8:46 PM
    Moderator

All replies

  • Hi Aric,

     I see a couple of issues with your code snippet. First of all, you should not be using TCP. We will not support TCP at runtime as a means of transport. Secondly, you should be targeting the router (ProjectServer.svc) directly and let the router do it's job. The URL for the router should look something like this:

    "http://ProjectServer/pwa/_vti_bin/PSI/ProjectServer.svc" -- alternatively a port number if you are not running your front-end off port 80.

    Another note is that you will use the same URL (that is http://ProjectServer/pwa/_vti_bin/PSI/ProjectServer.svc) regardless of what business object you are targeting. So, if you are using proxies, you have the Url property on the proxy and if you are using the interfaces directly (via ChannelFactory and CreateChannel) you pass the Url as the EndpointAddress argument.

    Hope this helps!

    Thanks,
    Boaz Lev
    MSFT
    Monday, March 15, 2010 8:46 PM
    Moderator
  • I did succeed working against the wcf service via code just not through the tcp chanel but the regular http.
    What you are saying is that you would not support connections through TCP only basic ones?
    If you will support TCP connections at RTM how would that be done via code? could you add a code snippet for that?
    I saw that the config files of the wcf projecr server services created by VS after adding the refernce include only the basic connection.
    aric katz
    Tuesday, March 16, 2010 5:45 AM
  • We will not support TCP at RTM. The issue is that TCP (and named pipes for that matter) are really, really good for duplex communications in the current WCF implementation. We inherently don't use that pattern of communication: We are more request response. Because of this, performance actually goes down if you use TCP or named pipes.

    To speak to your other question: The config files that are generated when you add a service reference in a VS project (I don't know if they have changed this for VS 2010) should really only be used for deriving contracts and addresses. As far as I know, the metadata infrastructure in WCF can't give enough information for a client to pick up the binding configuration properties.

    Hope this helps.

    Thanks,
    Boaz Lev
    MSFT
    Tuesday, March 16, 2010 5:29 PM
    Moderator
  • Hi Aric,

     I see a couple of issues with your code snippet. First of all, you should not be using TCP. We will not support TCP at runtime as a means of transport. Secondly, you should be targeting the router (ProjectServer.svc) directly and let the router do it's job. The URL for the router should look something like this:

    "http://ProjectServer/pwa/_vti_bin/PSI/ProjectServer.svc" -- alternatively a port number if you are not running your front-end off port 80.

    Another note is that you will use the same URL (that is http://ProjectServer/pwa/_vti_bin/PSI/ProjectServer.svc) regardless of what business object you are targeting. So, if you are using proxies, you have the Url property on the proxy and if you are using the interfaces directly (via ChannelFactory and CreateChannel) you pass the Url as the EndpointAddress argument.

    Hope this helps!

    Thanks,
    Boaz Lev
    MSFT

    It's quite useful, I got more deep understanding about this part, Thanks for your effort!
    Tuesday, October 12, 2010 12:09 AM