title: Streamwriter writes but gives web exception
body: <p>I am trying to insert data via web service. The code below writes to the database; however, I have an error (see bottom). What goes wrong here? and how to fix it?</p>
  
  <pre><code>//Create the web request
  HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
  
  //Set type to POST
  request.Method = "POST";
  request.ContentType = "text/XML";
  
  // Write data  
  using (StreamWriter postStream = new StreamWriter(request.GetRequestStream()))
  {
       postStream.WriteLine("&lt;biz_in&gt;&lt;phone_no&gt;+1604333333&lt;/phone_no&gt;&lt;/biz_in&gt;");
       postStream.Dispose();
  }
  </code></pre>
  
  <h2>Error:</h2>
  
  <p>System.Net.WebException was unhandled
    Message="The request was aborted: The request was canceled."
    Source="System"
    StackTrace:
         at System.Net.ConnectStream.CloseInternal(Boolean internalCall, Boolean aborting)
         at System.Net.ConnectStream.System.Net.ICloseEx.CloseEx(CloseExState closeState)
         at System.Net.ConnectStream.Dispose(Boolean disposing)
         at System.IO.Stream.Close()
         at System.IO.StreamWriter.Dispose(Boolean disposing)
         at System.IO.StreamWriter.Close()
         at ConsoleApplication1.Program.Main(String[] args) in C:/Program Files/Program.cs:line 62
         at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
         at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()</p>