Add WCF Reference to .Net 6

Manos Kanellopoulos 1 Reputation point
2022-11-26T23:15:02.597+00:00

I'm try to add this https://apps.ika.gr/WebServicesSepeNew-WebServicesSepe-context-root/WebServicesMainMethodSoap12HttpPort?wsdl WCF in an .Net 6 project through VS 2022 -> Add Service Reference -> WCF Service wizard.

I'm getting this warning

Cannot import wsdl:port\r\nDetail: \r\nXPath to Error Source: //wsdl:definitions[@targetNamespace='http://webservicessepe/']/wsdl:service[@name='WebServicesMainMethodService']/wsdl:port[@name='WebServicesMainMethodPort']  
Cannot import wsdl:binding\r\nDetail: An exception was thrown in a call to a policy import extension.\r\nExtension: System.ServiceModel.Channels.SecurityBindingElementImporter\r\nError: An unsupported security policy assertion was detected during the security policy import: <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">  
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">  
<sp:ProtectionToken>  
<wsp:Policy>  
<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">  
<wsp:Policy>  
<sp:RequireThumbprintReference />  
<sp:WssX509V3Token11 />  
</wsp:Policy>  
</sp:X509Token>  
</wsp:Policy>  
</sp:ProtectionToken>  
<sp:AlgorithmSuite>  
<wsp:Policy>  
<sp:Basic128 />  
</wsp:Policy>  
</sp:AlgorithmSuite>  
<sp:Layout>  
<wsp:Policy>  
<sp:Lax />  
</wsp:Policy>  
</sp:Layout>  
<sp:IncludeTimestamp />  
<sp:OnlySignEntireHeadersAndBody />  
</wsp:Policy>  
</sp:SymmetricBinding>\r\nXPath to Error Source: //wsdl:definitions[@targetNamespace='http://webservicessepe/']/wsdl:binding[@name='WebServicesMainMethodPortBinding']  

Add when its going to scaffolding service code its shows this error

Number of service endpoints found: 0
No code was generated.
If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services, or because all contracts/services were discovered to exist in --reference assemblies. Verify that you passed all the metadata documents to the tool.
Done.
ErrorFailed adding service reference(s). Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

If I try to added it in .net 4.6 framework and above its working correctly
Any ideas please?

Developer technologies | .NET | Other
Developer technologies | C#
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-11-28T03:00:59.093+00:00

    Hi @Manos Kanellopoulos ,

    First of all, according to the error information, please check whether there are valid contracts and services, and make sure that the names are corresponding.

    Then check out this docs to see if the steps it takes to add a service reference are any different from the ones you added.

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Lex Li (Microsoft) 6,037 Reputation points Microsoft Employee
    2022-11-28T07:39:51.287+00:00

    You can only post to the WCF repo and hope anyone there can give you a definite answer,

    https://github.com/dotnet/wcf/issues

    The error message is clear the "An unsupported security policy assertion was detected during the security policy", so asking on GitHub can tell you if any hope that security policy is going to be supported in the future.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.