Click here to Skip to main content
15,896,489 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I am facing the proble when I am trying to access service which is hosted in server from winForm

Server : http://www.xyz.com/abc/service1.svc

When I am trying to access I am getting this error

Service1Client s = new Service1Client();
       private void button1_Click(object sender, EventArgs e)
       {
           try
           {
               MessageBox.Show("Result: " + s.GetError());


           }
           catch (FaultException fex)
           {
               MessageBox.Show("FaultException: " + fex.Message);
           }
           catch (CommunicationException cex)
           {
               MessageBox.Show("CommunicationException: " + cex.Message);
           }
           catch (Exception ex)
           {
               MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
       }


always the communication error is happening

please suggest me.
Posted

1 solution

Check the content type. It might be application/json instead of text/html.

Good luck!
 
Share this answer
 
Comments
Suman Blr 30-May-14 7:33am    
Where i need to set this ?

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

  Print Answers RSS


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