0

Can someone give me sample code or any concept to consume/call a wcf service with Basic Authentication (Need to Pass UserName and Password) From dot net core API. I am consuming this wcf service from dot net API from the API header I am only passing the input which is integer value(not the username not the password). But the wcf service is expecting username and password while consumption. Can anyone help me which concepts come here to pass the credentials while consuming the service without hardcode in code.

Thanks in advance.

1
  • Sorry for the wrong heading Commented May 18, 2021 at 19:52

1 Answer 1

1

WCF is a technology that is principally bound to the platform specific .net framework. I would caution against using it in a dotnet core world unless you really have to, and thoroughly understand the consequences of doing so.

There is an overhead to using it, which in most use cases nowadays is entirely unecessary (most APIs do not get anywhere near the integration complexity that WCF mitigates, there are better solutions for IPC and there are strong competitors in the enterprise integration space.)

That said, depending on the transport that you are using (http, tcp) you may be able to use the limited client side porting available in the nuget packages at http://github.com/dotnet/wcf. These packages provide the base classes like ClientBase that could be used to achieve the servicereference functionality. Code will differ depending on the use case.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.