locked
SL2B2: ADO.Net Data Services fails to BeginnSaveChanges RRS feed

  • Question

  • Hi, im trying to sort out some issues with Ado.net data services.

     

    The following code throws me an exception:

    Code Snippet

     try
                {
                    product _product = new product();
                    _product.product_article_number = "xy1234";
                    sachariaEntities _sacharia = new sachariaEntities(new Uri(_serviceUriString, UriKind.RelativeOrAbsolute));
                    _sacharia.MergeOption = MergeOption.AppendOnly;
                    _sacharia.AddObject("product", _product);
                    _sacharia.BeginSaveChanges(SaveChangesOptions.ContinueOnError, delegate(IAsyncResult ar) { _sacharia.EndSaveChanges(ar); }, null);
                }
                catch (Exception ex)
                {
                    
                    throw ex;
                }

     

    And the exception i get:

    -        InnerException    {System.InvalidOperationException: Failed to Invoke: callOpen.
       at System.Windows.Browser.ScriptObject.Invoke(String name, Object[] args)
       at System.Data.Services.Http.ScriptObjectUtility.CallOpen(ScriptObject request, String method, String uri)
       at System.Data.Services.Http.HttpWebRequest.ScriptXmlHttpRequest.Open(Boolean async, String url, String method, Action OnReadyStateChange)
       at System.Data.Services.Http.HttpWebRequest.InvokeRequest(Boolean async)
       at System.Data.Services.Http.HttpWebRequest.BeginGetResponse(AsyncCallback callback, Object state)
       at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.AsyncEndWrite(IAsyncResult asyncResult)}    System.Exception {System.InvalidOperationException}

     

    Can anyone point me in the right direction ? Sadly i couldnt find anything on google or anywhere else...

     

    Thanks!

    P.S. I posted this exact post in the silverlight forums and was asked to post it here as well.
    Furthermore i was asked to provide the following information:

    a) browser version
    - Firefox 3
    - IE 8
    b) Check if Javascript is enabled in the browser.
    - yes Javascript is enabled in the browser.
    c) the URI to the Silverlight page and the uri to the Data Service.
    Since both the silverlight page and the uri to the data service are still on my localhost, i checked if they are life and good to go.

    - the data service is running on http://localhost:3974/WebDataService1.svc/ and can be looked at before i execute the silverlight application

    - http://localhost:3187/SilverlightApplication16TestPage.aspx is the silverlight application, and this error occurs in both browsers. I just saw another thing while trying it with IE 8:

    Webpage Script Errors

    User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; WOW64; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; FDM; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.5.30428)
    Timestamp: Tue, 24 Jun 2008 06:14:27 UTC

    0.
    Message: Access is denied.

    Line: 1
    Char: 1
    Code: 0
    URI: http://localhost:3187/SilverlightApplication16TestPage.aspx


    Tuesday, June 24, 2008 6:15 AM

Answers

  •  

    Okay, so i posted this morning, and was thinking about the problem all morning!

     Now i got it working, it was my fault.

    This was the problem: I had the service in a new Project, thus it was a cross-domain call even though it is all localhost.

    Now i just inserted the service to the silverlight application and compiled a new .cs file from this webdataservice...

    and then i followed the instructions..

    so it is really quiet simple, if you do not make crossdomain calls...

    Tuesday, June 24, 2008 11:16 AM