Harsh
Harsh

Reputation: 388

Web Services Not connecting in First Attempt

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

Upvotes: 3

Views: 965

Answers (1)

tcarvin
tcarvin

Reputation: 10855

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

Upvotes: 2

Related Questions