Hello, unfortunately the method "System.ServiceModel.EndpointIdentity.CreateUpnIdentity" does not exist for .net standard 2.0. I need this method for creating a EndpointAddress:
EndpointAddress myEndpoint = new EndpointAddress(new Uri(wcfEndpoint.Endpoint), EndpointIdentity.CreateUpnIdentity(wcfEndpoint.Identity));
What can I do to make this also work on .net standard?
Try this:
c#
EndpointAddress myEndpoint = new EndpointAddress(new Uri(wcfEndpoint.Endpoint), new UpnEndpointIdentity(wcfEndpoint.Identity));
I also had the feeling that I could use this, but I was not sure.
So if I use this, will there be any side effects that I should know about?
No side effects. You can see the code of the CreateUpnIdentity static method here. I'll paste it here for convenience:
c#
public static EndpointIdentity CreateUpnIdentity(string upnName)
{
return new UpnEndpointIdentity(upnName);
}
So instead of calling a static method which just constructs an object for you and returns it, you can directly construct the object and you get identical results.
As an aside, part of some of the pain and difficulty people have with using WCF is there's about 20 ways to do the exact same thing. I'm trying to minimize that with the .NET Core implementation as much as is reasonable which sometimes means small but compatible code changes need to be done.
Let us know if you have any other questions.
Most helpful comment
Try this:
c# EndpointAddress myEndpoint = new EndpointAddress(new Uri(wcfEndpoint.Endpoint), new UpnEndpointIdentity(wcfEndpoint.Identity));