Hola espero estén todos bien, tengo un pequeño problema con una app web que estoy intentando hacer en C# y que consume el servicio web del Master Data Services, en concreto cuando corro el programa este es el error que me aparece
"Security Support Provider Interface (SSPI) authentication failed. The server may not be running in an account with identity 'http://domain:port'. 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"
el programa lo estoy corriendo desde una maquina local, mientras el web service se encuentra en un servidor dentro de la misma red, el codigo es mas o menos el siguiente:
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;
}
}
}
}