0
votes

I am converting my Web API in .Net framework 4 to .NET Core 3.1, and in API I am consuming a vendor WCF service. The WCF Service using Mutual certificate Authentication and basicHttpBinding and customBinding. I could add the proxy classes through wsdl in "Connected Services" in project. But I am struggling to convert configuration section in old web.config in appsettings.json and and how to use it in startup.cs. Below the <syste.ServiceModel> configuration section from old Web.config (from Web API in .Net Framework 4)

<system.serviceModel>
    <services />
    <behaviors>
        <endpointBehaviors>
            <behavior name="hz.behavior.rdy">
                <clientCredentials>
                    <clientCertificate findValue="TestWCF" storeLocation="LocalMachine" storeName="Root" x509FindType="FindBySubjectName" />
                    <serviceCertificate>
                        <defaultCertificate findValue="de607fe9qwrqwrtqtqetqetq74bf292ebe87c0dbbe3716" storeLocation="LocalMachine" storeName="Root" x509FindType="FindByThumbprint" />
                    </serviceCertificate>
                </clientCredentials>
            </behavior>
        </endpointBehaviors>
        <serviceBehaviors />
    </behaviors>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IDebitCard" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
            <binding name="BasicHttpBinding_IAuthentication" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>
        <wsHttpBinding>
            <binding name="wsHttpEndpoint" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" >
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                <security mode="TransportWithMessageCredential">
                    <transport clientCredentialType="None" />
                    <message clientCredentialType="UserName" establishSecurityContext="false" />
                </security>
            </binding>
        </wsHttpBinding>
        <customBinding>
            <binding name="BalanceInquiryServiceSoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
                <textMessageEncoding messageVersion="Soap12" />
                <security defaultAlgorithmSuite="Basic128Rsa15" allowSerializedSigningTokenOnReply="true" authenticationMode="MutualCertificate" securityHeaderLayout="Lax" allowInsecureTransport="false" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSecurityContextCancellation="false" />
                <httpsTransport />
            </binding>
            <binding name="CardStatusChangeServiceSoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
                <textMessageEncoding messageVersion="Soap12" />
                <security defaultAlgorithmSuite="Basic128Rsa15" allowSerializedSigningTokenOnReply="true" authenticationMode="MutualCertificate" securityHeaderLayout="Lax" allowInsecureTransport="false" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSecurityContextCancellation="false" />
                <httpsTransport />
            </binding>
            <binding name="CardNumberInquiryServiceSoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
                <textMessageEncoding messageVersion="Soap12" />
                <security defaultAlgorithmSuite="Basic128Rsa15" allowSerializedSigningTokenOnReply="true" authenticationMode="MutualCertificate" securityHeaderLayout="Lax" allowInsecureTransport="false" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSecurityContextCancellation="false" />
                <httpsTransport />
            </binding>
            <binding name="PinInquiryServiceSoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
                <textMessageEncoding messageVersion="Soap12" />
                <security defaultAlgorithmSuite="Basic128Rsa15" allowSerializedSigningTokenOnReply="true" authenticationMode="MutualCertificate" securityHeaderLayout="Lax" allowInsecureTransport="false" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSecurityContextCancellation="false" />
                <httpsTransport />
            </binding>
            <binding name="LoadUnloadPurseServiceSoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
                <textMessageEncoding messageVersion="Soap12" />
                <security defaultAlgorithmSuite="Basic128Rsa15" allowSerializedSigningTokenOnReply="true" authenticationMode="MutualCertificate" securityHeaderLayout="Lax" allowInsecureTransport="false" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSecurityContextCancellation="false" />
                <httpsTransport />
            </binding>
            <binding name="TransactionHistoryServiceSoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
                <textMessageEncoding messageVersion="Soap12" />
                <security defaultAlgorithmSuite="Basic128Rsa15" allowSerializedSigningTokenOnReply="true" authenticationMode="MutualCertificate" securityHeaderLayout="Lax" allowInsecureTransport="false" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSecurityContextCancellation="false" />
                <httpsTransport maxReceivedMessageSize="2147483647" />
            </binding>
            <binding name="CustomerInfoUpdateServiceSoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
                <textMessageEncoding messageVersion="Soap12" />
                <security defaultAlgorithmSuite="Basic128Rsa15" allowSerializedSigningTokenOnReply="true" authenticationMode="MutualCertificate" securityHeaderLayout="Lax" allowInsecureTransport="false" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSecurityContextCancellation="false" />
                <httpsTransport maxReceivedMessageSize="2147483647" />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAuthentication" contract="AuthWS.IAuthentication" name="AuthWs.IAuthentication" />
        <endpoint address="https://services.debitcardprovider.com/hzwbsvc/services/BalanceInquiryServicePort" binding="customBinding" bindingConfiguration="BalanceInquiryServiceSoapBinding" contract="BalanceInquiryService.BalanceInquiryService" name="BalanceInquiryServicePort" behaviorConfiguration="hz.behavior.rdy" />
        <endpoint address="https://services.debitcardprovider.com/hzwbsvc/services/CardStatusChangeServicePort" binding="customBinding" bindingConfiguration="CardStatusChangeServiceSoapBinding" contract="CardStatusChangeService.CardStatusChangeService" name="CardStatusChangeServicePort" behaviorConfiguration="hz.behavior.rdy" />
        <endpoint address="https://services.debitcardprovider.com/hzwbsvc/services/CardNumberInquiryServicePort" binding="customBinding" bindingConfiguration="CardNumberInquiryServiceSoapBinding" contract="CardNumberInquiryService.CardNumberInquiryService" name="CardNumberInquiryServicePort" behaviorConfiguration="hz.behavior.rdy" />
        <endpoint address="https://services.debitcardprovider.com/hzwbsvc/services/PinInquiryServicePort" binding="customBinding" bindingConfiguration="PinInquiryServiceSoapBinding" contract="PinInquiryService.PinInquiryService" name="PinInquiryServicePort" behaviorConfiguration="hz.behavior.rdy" />
        <endpoint address="https://services.debitcardprovider.com/hzwbsvc/services/LoadUnloadPurseServicePort" binding="customBinding" bindingConfiguration="LoadUnloadPurseServiceSoapBinding" contract="LoadUnloadPurseService.LoadUnloadPurseService" name="LoadUnloadPurseServicePort" behaviorConfiguration="hz.behavior.rdy" />
        <endpoint address="https://services.debitcardprovider.com/hzwbsvc/services/TransactionHistoryServicePort" binding="customBinding" bindingConfiguration="TransactionHistoryServiceSoapBinding" contract="TransactionHistoryService.TransactionHistoryService" name="TransactionHistoryServicePort" behaviorConfiguration="hz.behavior.rdy" />
        <endpoint address="https://services.debitcardprovider.com/hzwbsvc/services/CustomerInfoUpdateServicePort" binding="customBinding" bindingConfiguration="CustomerInfoUpdateServiceSoapBinding" contract="CustomerInfoUpdateService.CustomerInfoUpdateService" name="CustomerInfoUpdateServicePort" behaviorConfiguration="hz.behavior.rdy" />
    </client>
</system.serviceModel>
1

1 Answers

0
votes

If I understand you correctly, your question is that. NET Framework 4 converts to. NET Core 3.1 which configuration to change.

The link below may answer you question.

https://www.outsystems.com/blog/posts/migrating-from-net-framework-to-net-core/

Thanks.