Hi, I hope you are all right, I have a small problem with a web app that I am trying to do in C # and that consumes the Web service of the Master Data Services, specifically when I run the program this is the error that appears to me
"Security Support Provider Interface (SSPI) authentication failed. server may not be running in an account with identity ' link '. If the server is running in a service account (Network Service for example), specify the account's ServicePrincipalName as the identity in the EndpointAddress for the server If the server is running in a user account, specify the account's UserPrincipalName as the identity in the EndpointAddress for the server "
I am running the program from a local machine, while the web service is on a server within the same network, the code is more or less the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceModel;
using MasterDataWS.mdsws;
namespace MasterDataWS
{
class Program
{
private static ServiceClient mdsProxy;
public static string mdsURL = "http://domain:port/service/service.svc";
static void Main(string[] args)
{
try
{
mdsProxy = clientProxy(mdsURL);
Console.WriteLine("Conection Success");
createEntityMember("Test_Model", "Version_1", "WSTest", "Nombre", "1", MemberType.Leaf);
Console.WriteLine("Publish Success");
}catch (Exception e)
{
Console.WriteLine("Error: " + e);
}
Console.ReadKey();
}
//Clase Proxy
private static ServiceClient clientProxy(string serverURL)
{
WSHttpBinding wsBinding = new WSHttpBinding();
EndpointAddress pointAddress = new EndpointAddress(serverURL);
return new ServiceClient (wsBinding, pointAddress);
}
//Crear entity members
private static void createEntityMember(string modelName, string version, string entityName, string newName, string newCode, MemberType memberType)
{
EntityMembersCreateRequest createRequest = new EntityMembersCreateRequest();
createRequest.Members = new EntityMembers();
createRequest.ReturnCreatedIdentifiers = true;
createRequest.Members.ModelId = new Identifier { Name = modelName };
createRequest.Members.VersionId = new Identifier { Name = version };
createRequest.Members.EntityId = new Identifier { Name = entityName };
createRequest.Members.MemberType = memberType;
createRequest.Members.Members = new System.Collections.ObjectModel.Collection<Member> { };
Member newMember = new Member();
newMember.MemberId = new MemberIdentifier() { Name = newName, Code = newCode, MemberType = memberType };
createRequest.Members.Members.Add(newMember);
EntityMembersCreateResponse createResponse = mdsProxy.EntityMembersCreate(createRequest);
handleOperationErrors(createResponse.OperationResult);
}
//Manejador de errores
private static void handleOperationErrors (OperationResult result)
{
string errorMessage = string.Empty;
if(result.Errors.Count > 0)
{
foreach(Error anError in result.Errors)
{
errorMessage += "Operation Error: " + anError.Code + " " + anError.Description + "\n";
}
Console.WriteLine(errorMessage);
Exception ex = new Exception(errorMessage);
throw ex;
}
}
}
}