none
WCF Service unable to connect to Client Service RRS feed

  • Question

  • I have developed a WCF service and it is well to Receive and process request, i have a client service to which i need to send a request. While calling the client service   i am facing below issue. I developed this WCF service on .net 4.5 frame work and Target frame work on server is .net 4.0.

    SERVICEINSTANTIATE:SYSTEM.THREADING.THREADABORTEXCEPTION: THREAD WAS BEING ABORTED.
       AT SYSTEM.MODULEHANDLE.RESOLVETYPE(RUNTIMEMODULE MODULE, INT32 TYPETOKEN, INTPTR TYPEINSTARGS, INT32 TYPEINSTCOUNT, INTPTR METHODINSTARGS, INT32 METHODINSTCOUNT, OBJECTHANDLEONSTACK TYPE)
       AT SYSTEM.MODULEHANDLE.RESOLVETYPEHANDLEINTERNAL(RUNTIMEMODULE MODULE, INT32 TYPETOKEN, RUNTIMETYPEHANDLE[] TYPEINSTANTIATIONCONTEXT, RUNTIMETYPEHANDLE[] METHODINSTANTIATIONCONTEXT)
       AT SYSTEM.REFLECTION.RUNTIMEMODULE.RESOLVETYPE(INT32 METADATATOKEN, TYPE[] GENERICTYPEARGUMENTS, TYPE[] GENERICMETHODARGUMENTS)
       AT SYSTEM.REFLECTION.CUSTOMATTRIBUTE.FILTERCUSTOMATTRIBUTERECORD(CUSTOMATTRIBUTERECORD CARECORD, METADATAIMPORT SCOPE, ASSEMBLY& LASTAPTCAOKASSEMBLY, RUNTIMEMODULE DECORATEDMODULE, METADATATOKEN DECORATEDTOKEN, RUNTIMETYPE ATTRIBUTEFILTERTYPE, BOOLEAN MUSTBEINHERITABLE, OBJECT[] ATTRIBUTES, ILIST DERIVEDATTRIBUTES, RUNTIMETYPE& ATTRIBUTETYPE, IRUNTIMEMETHODINFO& CTOR, BOOLEAN& CTORHASPARAMETERS, BOOLEAN& ISVARARG)
       AT SYSTEM.REFLECTION.CUSTOMATTRIBUTE.GETCUSTOMATTRIBUTES(RUNTIMEMODULE DECORATEDMODULE, INT32 DECORATEDMETADATATOKEN, INT32 PCACOUNT, RUNTIMETYPE ATTRIBUTEFILTERTYPE, BOOLEAN MUSTBEINHERITABLE, ILIST DERIVEDATTRIBUTES, BOOLEAN ISDECORATEDTARGETSECURITYTRANSPARENT)
       AT SYSTEM.REFLECTION.CUSTOMATTRIBUTE.GETCUSTOMATTRIBUTES(RUNTIMEASSEMBLY ASSEMBLY, RUNTIMETYPE CATYPE)
       AT SYSTEM.REFLECTION.RUNTIMEASSEMBLY.GETCUSTOMATTRIBUTES(TYPE ATTRIBUTETYPE, BOOLEAN INHERIT)
       AT SYSTEM.CONFIGURATION.TYPEUTIL.HASAPTCABIT(ASSEMBLY ASSEMBLY)
       AT SYSTEM.CONFIGURATION.TYPEUTIL.ISTYPEFROMTRUSTEDASSEMBLYWITHOUTAPTCA(TYPE TYPE)
       AT SYSTEM.CONFIGURATION.BASECONFIGURATIONRECORD.FINDANDENSUREFACTORYRECORD(STRING CONFIGKEY, BOOLEAN& ISROOTDECLAREDHERE)

    Thursday, December 15, 2016 4:45 PM

Answers

  • Hi Santhu.net,

    I am glad you made it work by calling it from windows service, and I would suggest you mark your reply as answer to close this thread.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Santhu.net Wednesday, January 11, 2017 9:22 AM
    Wednesday, January 11, 2017 7:13 AM

All replies

  • Hi Santhu.net,

    Could you share us more information about your issue?

    1. What is your client service? Do you mean it is a client side for WCF Service or you create a new service in client side?
    2. Do you mean send request to client service or client service sent request?
    3. How did you design client service and how did you call client service from WCF Service

    I suggest you enable Configuring Tracing to check detailed error.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 16, 2016 2:32 AM
  • Hi Edward,

    Many Thanks for the response.

    Below are my Answers.

    1.Client Service is written in Java,its another partner(Third Party Integration).

    2.Sending request from WCF service to Client service which is Java.

    3.By using WSDL document ,i generated proxy class in WCF service, and calling client service using the proxy class and sending request.

    Note:I used the same proxy class and developed a small windows application which is sucessful in sending and Receiving response. The issue is only with WCF service. This is HTTPS based service we installed certificate too on the server and pointed it on IIS.

    Below are logs from EventViewer on Windows server 2003.

    ASP.NET 4.0.30319.0

    An unhandled exception occurred and the process was terminated.

    Application ID: DefaultDomain
    Process ID: 6116
    Exception: System.AppDomainUnloadedException
    Message: Attempted to access an unloaded AppDomain.
    StackTrace: 
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

    Below is .net 4.0  Runtime Error

    EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.3959, P3 45d6968e, P4 system, P5 4.0.0.0, P6 53b51323, P7 3937, P8 38, P9 tzgqr4ktz5clnkymwu2xgqwcjz00c3ra, P10 NIL.

    Below is .net Runtime Error

    Application: w3wp.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.Configuration.SettingsPropertyNotFoundException
    Stack:
       at System.Configuration.SettingsBase.GetPropertyValueByName(System.String)
       at System.Configuration.SettingsBase.get_Item(System.String)
       at System.Configuration.ApplicationSettingsBase.GetPropertyValue(System.String)
       at System.Configuration.ApplicationSettingsBase.get_Item(System.String)
       at TrustPayIntegration.Properties.Settings.get_TrustPayIntegration_biz_trustpay_my_TransactionNotification()
       at TrustPayIntegration.biz.trustpay.my.TransactionNotification..ctor()
       at TrustPayIntegration.Partner2CustomerService.PaymentConfirmation(TrustPayIntegration.PaymentConfirmation)
       at TrustPayIntegration.Partner2CustomerService+<>c__DisplayClass2.<USSDRequest>b__0()
       at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
       at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
       at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
       at System.Threading.ThreadHelper.ThreadStart()
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

    Regards,

    Santhu.Net


    • Edited by Santhu.net Friday, December 16, 2016 7:02 AM
    Friday, December 16, 2016 6:59 AM
  • Hi Santhu.net,

    Could you share us the code which you used to call Java Service from WCF Service?

    >> System.Configuration.SettingsPropertyNotFoundException

    Based on this error message, did you read any setting in Configuration?

    Could you debug your WCF Service method to check which line get this error?

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 16, 2016 7:37 AM
  • Hi Edward,

    Below are two lines i am trying to use from my WCF application to call that Java Service.

    TransactionNotificationClient tn = new TransactionNotificationClient();
       client_response = tn.notify(Payment.ReferenceID, Payment.accepted, Payment.error_message);

    Error I am facing at Class Instantiate as above, i see exception at debug as "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack" 

    Below is the proxy class generated code

                                                                                                                                                                                                                    

    using System;
    namespace TrustPayIntegration.TrustPayService {


        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
        [System.ServiceModel.ServiceContractAttribute(Namespace="http://webservice.trustpay.biz/", ConfigurationName="TrustPayService.TransactionNotification")]
        public interface TransactionNotification {

            // CODEGEN: Generating message contract since element name transactionID from namespace  is not marked nillable
            [System.ServiceModel.OperationContractAttribute(Action="http://webservice.thirdpartyurl/notifyrequest", ReplyAction="http://webservice.thirdpartyur/notifyResponse")]
            TrustPayIntegration.TrustPayService.notifyResponse notify(TrustPayIntegration.TrustPayService.notifyRequest request);
        }

        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
        public partial class notifyRequest {

            [System.ServiceModel.MessageBodyMemberAttribute(Name="notify", Namespace="http://webservice.trustpay.biz/", Order=0)]
            public TrustPayIntegration.TrustPayService.notifyRequestBody Body;

            public notifyRequest() {
            }

            public notifyRequest(TrustPayIntegration.TrustPayService.notifyRequestBody Body) {
                this.Body = Body;
            }
        }

        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        [System.Runtime.Serialization.DataContractAttribute(Namespace="")]
        public partial class notifyRequestBody {

            [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
            public string transactionID;

            [System.Runtime.Serialization.DataMemberAttribute(Order=1)]
            public bool success;

            [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
            public string errormessage;

            public notifyRequestBody() {
            }

            public notifyRequestBody(string transactionID, bool success, string errormessage) {
                this.transactionID = transactionID;
                this.success = success;
                this.errormessage = errormessage;
            }
        }

        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
        public partial class notifyResponse {

            [System.ServiceModel.MessageBodyMemberAttribute(Name="notifyResponse", Namespace="http://webservice.trustpay.biz/", Order=0)]
            public TrustPayIntegration.TrustPayService.notifyResponseBody Body;

            public notifyResponse() {
            }

            public notifyResponse(TrustPayIntegration.TrustPayService.notifyResponseBody Body) {
                this.Body = Body;
            }
        }

        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        [System.Runtime.Serialization.DataContractAttribute(Namespace="")]
        public partial class notifyResponseBody {

            [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
            public string @return;

            public notifyResponseBody() {
            }

            public notifyResponseBody(string @return) {
                this.@return = @return;
            }
        }

        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
        public interface TransactionNotificationChannel : TrustPayIntegration.TrustPayService.TransactionNotification, System.ServiceModel.IClientChannel {
        }

        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
        public partial class TransactionNotificationClient : System.ServiceModel.ClientBase<TrustPayIntegration.TrustPayService.TransactionNotification>, TrustPayIntegration.TrustPayService.TransactionNotification {

            public TransactionNotificationClient() {
            }

            public TransactionNotificationClient(string endpointConfigurationName) : 
                    base(endpointConfigurationName) {
            }

            public TransactionNotificationClient(string endpointConfigurationName, string remoteAddress) : 
                    base(endpointConfigurationName, remoteAddress) {
            }

            public TransactionNotificationClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                    base(endpointConfigurationName, remoteAddress) {
            }

            public TransactionNotificationClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                    base(binding, remoteAddress) {
            }

            [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
            TrustPayIntegration.TrustPayService.notifyResponse TrustPayIntegration.TrustPayService.TransactionNotification.notify(TrustPayIntegration.TrustPayService.notifyRequest request) {
                try
                {
                    return base.Channel.notify(request);
                }
                catch(Exception ex){}
                return base.Channel.notify(request);
            }

            public string notify(string transactionID, bool success, string errormessage) {
                TrustPayIntegration.TrustPayService.notifyRequest inValue = new TrustPayIntegration.TrustPayService.notifyRequest();
                inValue.Body = new TrustPayIntegration.TrustPayService.notifyRequestBody();
                inValue.Body.transactionID = transactionID;
                inValue.Body.success = success;
                inValue.Body.errormessage = errormessage;
                TrustPayIntegration.TrustPayService.notifyResponse retVal = ((TrustPayIntegration.TrustPayService.TransactionNotification)(this)).notify(inValue);
                return retVal.Body.@return;
            }
        }
    }

    Below is the web.config file details generated at WSDL consumption

    <bindings>
          <basicHttpBinding>
            <binding name="TransactionNotificationPortBinding">
              <security mode="Transport" />
            </binding>

    <client>
          <endpoint address="https://ThirdpartyUrl"
            binding="basicHttpBinding" bindingConfiguration="TransactionNotificationPortBinding"
            contract="TrustPayService.TransactionNotification" name="TransactionNotificationPort" />
          </client>


    Thanks & Regards,

    Santhu.Net


    • Edited by Santhu.net Friday, December 16, 2016 7:06 PM
    Friday, December 16, 2016 6:58 PM
  • Hi Santhu.net,

    Do you mean you got exception in this line “TransactionNotificationClient tn = new TransactionNotificationClient();”?

    Do you generate client code by Adding Service Reference from VS?

    To check whether it is related with WCF application, I suggest you try to implement Java Service from Console application. If it did not work under Console application, I would suggest you try to confirm with Java Service developer to confirm how to consume Java Service in .net application.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 19, 2016 2:00 AM
  • Do you mean you got exception in this line “TransactionNotificationClient tn = new TransactionNotificationClient();”?

    Yes, at that line i am facing issue.

    Do you generate client code by Adding Service Reference from VS?

    Yes,I generated It.

    I suggest you try to implement Java Service from Console application

    Yes, It was working fine from windows application and i am able to receive response.But issue is only with WCF service implementation.

    Any way , now i managed the service by calling it from windows service and made it to run all the time.:)

    Thanks & Regards,

    Santhu.Net

    Tuesday, January 10, 2017 12:48 PM
  • Hi Santhu.net,

    I am glad you made it work by calling it from windows service, and I would suggest you mark your reply as answer to close this thread.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Santhu.net Wednesday, January 11, 2017 9:22 AM
    Wednesday, January 11, 2017 7:13 AM