Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3809454
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:18:28+00:00 2026-05-19T15:18:28+00:00

I have tried everything and I can not figure out why this error happens.

  • 0

I have tried everything and I can not figure out why this error happens.

Background:
I have an IPad application, written in MonoTouch and I have a thread that runs in the background, and every 15 seconds I sync data with the server. This works the first few iterations of the thread, but eventually I get the following stack trace.

An exception occured: System.Net.WebException: Error getting response stream (ReadDone4): ServerProtocolViolation ---> System.FormatException: Input string was not in the correct format
  at System.UInt32.Parse (System.String s) [0x00010] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/UInt32.cs:405 
  at System.Net.WebConnection.GetResponse (System.Byte[] buffer, Int32 max) [0x000ba] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebConnection.cs:565 
  at System.Net.WebConnection.ReadDone (IAsyncResult result) [0x00095] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebConnection.cs:446 
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x0005e] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:819 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:827 
  at SyncService.REST.RestClient.Execute[IEnumerable`1] (SyncService.REST.RestRequest request) [0x00079] in /Users/Chris/Compass/SyncService/REST/RestClient.cs:42 

I am talking to an IIS webserver with default configuration.
Here is the method I am calling:

public RestResponse<T> Execute<T>(RestRequest request){
    var restResponse = new RestResponse<T>();
    var serializer = new JavaScriptSerializer();
    var urlPath = _baseUrl + "/" + request.Resource;
    var httpRequest = (HttpWebRequest)HttpWebRequest.Create(new Uri(urlPath));

    httpRequest.Headers = request.Headers;
    Authenticator.Authenticate(httpRequest);

    httpRequest.Method = request.Method.ToString();
    if (request.Method == Method.POST)
        SetPostData(httpRequest, request);

    HttpWebResponse httpResponse = null;
    try{
        httpResponse = (HttpWebResponse) httpRequest.GetResponse();
        var reader = new StreamReader(httpResponse.GetResponseStream());
        var responseString = reader.ReadToEnd();
        reader.Close();
        restResponse.StatusCode = httpResponse.StatusCode;
        restResponse.Headers = httpResponse.Headers;
        restResponse.Data = serializer.Deserialize<T>(responseString);
        restResponse.ResponseStatus = ResponseStatus.Completed;
    } 
    catch(WebException e){

        restResponse.ResponseStatus = ResponseStatus.Error;
        restResponse.ErrorMessage = e.Message;
        restResponse.ErrorException = e;
        var webResponse = (HttpWebResponse) e.Response;
        if (webResponse != null){
            restResponse.StatusCode = webResponse.StatusCode;
            restResponse.Headers = webResponse.Headers;
        }
        if (restResponse.StatusCode != HttpStatusCode.NotModified)
            Console.WriteLine("An exception occured: " + e + "\r\n");
    }catch (Exception ex) {
        restResponse.ResponseStatus = ResponseStatus.Error;
        restResponse.ErrorMessage = ex.Message;
        restResponse.ErrorException = ex;
    }

    if (httpResponse != null) 
        httpResponse.Close();

    return restResponse;
}

Please help. I don’t know what to do. Google shows nothing.

I am able to make 22 successful requests before the error shows up.

EDIT
I have narrowed it down to being a server issue. This is asp.net MVC and the exception only happens when I send a 304 to the client. See Server Code:

private void ServeHttpStatusCode() {
    Response.StatusCode = 304;
    Response.Status = "304 Not Modified";
    Response.StatusDescription = "The resource you are requesting has not been modified";
    Response.ContentType = "application/json";
    Response.Write("{\"Error\":\"The resource you are requesting has not been modified\"}");
    Response.End();
    Response.Close();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:18:29+00:00Added an answer on May 19, 2026 at 3:18 pm
    • Is there a proxy between the client
      and the server?
    • Does it always fail after 22 requests?
      The exception indicates that some UInt32 can’t be parsed.
    • Do you get exceptions on the server side?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone I'm currently extremely frustrated and can not figure this out have looked
Having an issue here that I have tried everything I can think of but
Have tried to find solutions for this and can't really come up with anything.
I have tried this but it does not work (even if I specify .wav
I can not figure out where my problem is but I am not able
I've been searching for the last 2 hours and can't figure this out. I
I have tried everything, searched the net for two hours or even more and
I have tried to draw a bar in a cell of my table. Everything
I've tried almost everything. In my nginx.conf I have rails_env set to production in
I have tried to make the fullscreen feature of a SDI application with splitter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.