Click here to Skip to main content
14,735,810 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am getting  this error 

"The type initializer for 'System.ServiceModel.Diagnostics.TraceUtility' threw an exception."  While calling soap client web service " . Code gets above error when it reached to code    

ServiceReference1.WebservicesSoapClient srv =new  ServiceReference1.WebservicesSoapClient();
-----------------------------------------------This is my app.config--------------
<?xml version="1.0" encoding="utf-8" ?>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
                <binding name="WebservicesSoap">
                    <security mode="Transport" />
                <binding name="WebservicesSoap1" />
            <endpoint address="https://abc/v2/webservices.asmx"
                binding="basicHttpBinding" bindingConfiguration="WebservicesSoap"
                contract="ServiceReference1.WebservicesSoap" name="WebservicesSoap" />

Would some body guid on this ?

What I have tried:

I tired editing app.config . there is no much result found on intenrnet 
Updated 3-Jun-17 9:29am

1 solution

Try replacing the endpoint address="https://abc/v2/webservices.asmx" with a fixed ip address if possible, e.g.
endpoint address=""
Also you might need to add a port to the ip address.
Also make sure your firewall is not blocking the communication.
Also make sure you don't have settings in your project that interfere with app.config, try to remove the lines:
   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900