WCF Error - Could not find default endpoint element that references contract 'UserService.UserService'

前端 未结 13 1829
野趣味
野趣味 2020-11-29 02:27

Any ideas how to fix this?

UserService.UserServiceClient userServiceClient = new UserServiceClient();
            userServiceClient.GetUsersCompleted += new          


        
13条回答
  •  悲&欢浪女
    2020-11-29 03:06

    For those who work with AX 2012 AIF services and try to call there C# or VB project inside AX (x++) and suffer from such errors of "could not find default endpoint"... or "no contract found" ... go back to your visual studio (c#) project and add these lines before defining your service client, then deploy the project and restart AX client and retry: Note, the example is for NetTcp adapter, you could easily use any other adapter instead according to your need.

     Uri Address = new Uri("net.tcp://your-server:Port>/DynamicsAx/Services/your-port-name");
     NetTcpBinding Binding = new NetTcpBinding();
     EndpointAddress EndPointAddr = new EndpointAddress(Address);
     SalesOrderServiceClient Client = new SalesOrderServiceClient(Binding, EndPointAddr);
    

提交回复
热议问题