C# EndpointIdentity不包含CreateUpnIdentity的定义

C# EndpointIdentity不包含CreateUpnIdentity的定义,c#,.net-standard-2.0,C#,.net Standard 2.0,将类库从.NET Framework 4.6.2转换为.NET Standard 2.0时,我会遇到以下错误:“EndpointIdentity不包含CreateUpnIdentity的定义”。我需要做的更改是安装System.ServiceModel.Primitives。但不知何故,该库不包含“CreateUpnIdentity”的定义 您必须安装nuget软件包,然后才能使用: new DnsEndpointIdentity("localhost") 而不是这样做: identity =

将类库从.NET Framework 4.6.2转换为.NET Standard 2.0时,我会遇到以下错误:“EndpointIdentity不包含CreateUpnIdentity的定义”。我需要做的更改是安装System.ServiceModel.Primitives。但不知何故,该库不包含“CreateUpnIdentity”的定义

您必须安装nuget软件包,然后才能使用:

new DnsEndpointIdentity("localhost")
而不是这样做:

identity = EndpointIdentity.CreateUpnIdentity(self.Name);
您可以这样做:

identity = new UpnEndpointIdentity(self.Name);
请看这里:

identity = new UpnEndpointIdentity(self.Name);