AIF : Enable net.tcp binding on WCF service

Today I wanted to check out what the impact of changing the binding method to net.tcp instead of wsHttpBinding was. But to be able to use net.tcp as a binding, some things need to be done.

IIS Setup

The first thing to do is making sure everything is in place on the IIS 7 side.
For tcp.net being enabled as binding method, make sure the following feature is installed.

By installing this, you can add net.tcp bindings in IIS. So right now we can start by going to the IIS manager and add net.tcp as a binding method on the Dynamics Ax AIF Application.

After adding the site binding, enable the net.tcp binding as protocol on the Application

Dynamics Ax AIF Webservice setup

Once the IIS is ready to pass net.tcp requests, we can configure the Dynamics Ax Web Service to work with net.tcp binding.

Inside Dynamics Ax, go to Basic à Setup à Application Integration Framework à Services and click the configure button. Now the configuration editor will start. Here you can select the service you want to alter and change the binding method to net.tcp. You also have to specify the address here. In this case it is: net.tcp://hostname:808/DynamicsAX50AIFServices/nvmpconfigtableservice.svc

Once you have done this, you can go ahead and regenerate the service artifacts and refresh the services on the calling applications.

Warning: count(): Parameter must be an array or an object that implements Countable in /customers/5/2/1/ksaelen.be/httpd.www/wordpresses/dynamicsaxblog/wp-includes/class-wp-comment-query.php on line 399

7 thoughts on “AIF : Enable net.tcp binding on WCF service

  1. Very cool. It is always fun to have the power of WCF at your fingertips. I bet you could even write a custom binding and expose your web service over filesystem, much like the AIF File adapter does (but more WCF compliant).

  2. Hi,
    Nice article. Can you tell me – if I replace existing asmx webservice with a new WCF service with a TCP binding and configure as per above. And all the clients that were using that asmx service i change the webservice url reference to the new TCP WCF url in the client config. Will it then also require the change in client code in the way the new WCF web service proxy is created? Did i make sense?
    Thanks.
    J

  3. Hi Friend,

    My query is related to AIF webservices which i want to host on IIS of a different machine which is in the Same domain itself.
    I am able to run all the services in netTCP adapter which are the basic integration ports of dynamics ax 2012.
    But i am unable to run this services using HTTP adapter.

    I have deployed some standard AIF services onto the IIS of my IIS Server machine using HTTP adapter.

    It is allowing me to add service reference into the .net application but when i am going to run my application its giving me error in the AIF service method line itself.
    an error related to authentication that user is not authorized to view contents of this page or directory.I have tried with Ax administrator login.

    I have implemented the standard code which is available on msdn for calling and AIF web service using HTTP adapter.

    This is my code of Console application. I have added Sales Order Service as service reference which is deployed on iis.

    static void Main(string[] args)
    {
    // Create the sales order objects
    // Service client
    ServiceReference1.SalesOrderServiceClient cl = new ServiceReference1.SalesOrderServiceClient();

    // Sales order object to receive response
    ServiceReference1.AxdSalesOrder resp;

    // Create the entity key list for the request
    ServiceReference1.EntityKey[] readRespKeys = new ServiceReference1.EntityKey[1];
    readRespKeys[0] = new ServiceReference1.EntityKey();
    readRespKeys[0].KeyData = new ServiceReference1.KeyField[1];
    readRespKeys[0].KeyData[0] = new ServiceReference1.KeyField();
    readRespKeys[0].KeyData[0].Field = “SalesId”;

    // Ask the user for a sales order ID
    Console.WriteLine(“Enter the sales order ID:”);
    // Add the result to the entity key value
    readRespKeys[0].KeyData[0].Value = Console.ReadLine();

    try
    {
    // Try to read the sales order
    resp = cl.read(null, readRespKeys);
    // Display the information from the first sales table
    Console.WriteLine(“For sales order: ” + resp.SalesTable[0].SalesId);
    Console.WriteLine(“Customer Account is: ” + resp.SalesTable[0].CustAccount);
    }
    catch (Exception e)
    {
    Console.WriteLine(“Exception: ” + e.Message);
    Console.ReadKey();
    cl.Abort();
    }
    cl.Close();
    }

    Please provide some needful help that i can come out of this problem as soon as possible, and also third party should be able to use my services so ho can i pass credentials, because users wont be our Dynamics Ax users.

    Thanks in advance….

  4. @J
    Sorry for the late response… :)

    But if I understand correctly, your question is if the code wil need to change due to the fact the proxy client is now generated by WCF? Right?

    I do think there will be small changes depending on how the code is now calling the web services. When you will be adding your service reference to the WCF service, you will have to do some minor code changes I think so that the new proxy is used.

    If your new service has the same structure and parameters, the actual code with the logic will be the same, only the references to the new service and proxy could require some changes.

    regards,
    Kenny

  5. @Vijay Solanki
    Again sorry for the late answer :-)

    But I think you need to do this, (as I did) : The user/pass in stored in the config file

    public static RDSMobileAppServices.RDSMobileAppRuntimeServiceClient CreateRDSMobileAppRuntimeServiceClient()
    {
    var proxy = new RDSMobileAppServices.RDSMobileAppRuntimeServiceClient();
    proxy.ClientCredentials.Windows.ClientCredential = GetCredential();
    return proxy;
    }

    private static System.Net.NetworkCredential GetCredential()
    {
    return new System.Net.NetworkCredential(ConfigurationManager.AppSettings[“UserName”]
    , Common.Security.DecryptData(ConfigurationManager.AppSettings[“Password”])
    , ConfigurationManager.AppSettings[“Domain”]);
    }

Leave a Comment Yourself

Your email address will not be published. Required fields are marked *