Question

I am developing Application for Windows Phone using .Net Compact Framework 3.5

I am trying to connect Web Services from this application.

It is not connecting it in First Attempt, but it is connecting successfully in second and further attempts.

In First Attempt, It is giving "Web Exception" Error. enter image description here

I am using following code for connecting:

SalesService.SalesService obj = new SalesService.SalesService(); 
 string s = obj.CheckForValidService(); 

It is giving error in CheckForValidService method from Reference.cs file.

Error Details

Was it helpful?

Solution

Ah, the old Expect-100 header issue. You will need to surpress the use of that header.

System.Net.ServicePointManager.Expect100Continue = false;

MSDN details:

http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.expect100continue(v=vs.90).aspx

Stackoverflow details:

The request failed with HTTP status 417: Expectation Failed - Using Web Services

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top