locked
SaveChanges() throws exception: The response to this POST request did not contain a 'location' header. That is not supported by this client. RRS feed

  • Question

  • Hi there,

    I'm trying to insert  a new record into 'A160Pedimentos' table.

    public void ProcesaDS()
            {
                var proxy = new IntermediaEntities(new Uri("http://myserver/MyDataService.svc/"));
    
                var pedim = new A160Pedimentos
                {
                    fechapago = DateTime.Now,
                    clavecliente = "0001",
                    firmapago = "FIRma"
    
                };
    
                proxy.AddToA160Pedimentos(pedim);
                proxy.SaveChanges(); // Exception here
            }
    

    Problem is... proxy.SaveChanges() throws the following exception:


    System.NotSupportedException was unhandled
      Message="The response to this POST request did not contain a 'location' header. That is not supported by this client."
      Source="System.Data.Services.Client"
      StackTrace:
           at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.HandleOperationResponse(HttpWebRequest httpWebRequest, HttpWebResponse response)
           at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.BeginNextChange(Boolean replaceOnUpdate)
           at System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options)
           at System.Data.Services.Client.DataServiceContext.SaveChanges()
           at Pedimentos160.Procesar.ProcesaDS() in C:\Pedimentos160\Procesar.cs:line 121
           at Pedimentos160.Program.Main(String[] args) in C:\Pedimentos160\Program.cs:line 17
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
           at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
           at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
           at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
           at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
           at System.Activator.CreateInstance(ActivationContext activationContext)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: 
    

    Can someone please help?

    Regards,

    -Jorge








    Friday, November 6, 2009 6:46 PM

Answers

  • It seems like a server side error. Can you hit the service directly in Fiddler (http://www.fiddler2.com/fiddler2/) and see what the response is?

    Regards,
    PQ

    Peter Q. http://blogs.msdn.com/peter_qian
    • Marked as answer by Benton Friday, November 6, 2009 9:51 PM
    Friday, November 6, 2009 9:01 PM
    Answerer

All replies

  • Upon further tests I discovered that this error occurs when the service is hosted on my IIS server. If I consume the service when hosted from the Visual Studio integrated web server (localhost) the error does not happen.

    Any ideas?


    Friday, November 6, 2009 7:57 PM
  • It seems like a server side error. Can you hit the service directly in Fiddler (http://www.fiddler2.com/fiddler2/) and see what the response is?

    Regards,
    PQ

    Peter Q. http://blogs.msdn.com/peter_qian
    • Marked as answer by Benton Friday, November 6, 2009 9:51 PM
    Friday, November 6, 2009 9:01 PM
    Answerer
  • Well, it turns out I had a strange typo in the URI string. Fixed it and problem went away. I'm so ashamed...

    Thanks, Peter, for your kind suggestion. Thanks to Fiddler (first time I use it) I discovered the root cause.

    Regards,

    -Jorge
    Friday, November 6, 2009 9:51 PM