locked
System.Net.WebException: The remote server returned an error: NotFound. RRS feed

  • Question

  • Hi

    I am using Sync Framework 4.0 CTP Release and i created application for synchronising between two SQL server 2008 database. I was following the steps given in the forum http://msdn.microsoft.com/en-us/library/gg299026(v=SQL.110).aspx with slight changes like i didnt use filter conditions and also i am using "SyncSvcUtilHelper.exe" to create the Sync configuration and provisioning the database and for code generation also.

    As mentioned i created a Silver light application on my client side but when iam trying to run the application i am getting this error

    {System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
       at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
       at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
       at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
       --- End of inner exception stack trace ---
       at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
       at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
       at Microsoft.Synchronization.ClientServices.HttpCacheRequestHandler.OnDownloadGetResponseCompleted(IAsyncResult asyncResult)} System.Exception {System.Net.WebException}

    Below is the my xaml code which is used in my Silverlight application.

    using System;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using DestinationScope;
    using Microsoft.Synchronization.ClientServices.IsolatedStorage;
    
    namespace SyncClientSilverlight
    {
      public partial class MainPage : UserControl
      {
        DestinationScopeOfflineContext context = null;
        public MainPage()
        {
          InitializeComponent();
          context = new DestinationScopeOfflineContext("Client", new Uri(new Uri(new WebClient().BaseAddress), "../SourceScopeSyncService.svc/"));      
          context.LoadCompleted += new EventHandler<LoadCompletedEventArgs>(context_LoadCompleted);
          this.Loaded += new RoutedEventHandler(MainPage_Loaded);
          context.CacheController.RefreshCompleted += (sender, args) =>
          {
            if (args.Error != null)
            {
              Dispatcher.BeginInvoke(
                delegate
                {
                  MessageBox.Show(args.Error.ToString());
                });
            }
          };
        }
    
        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
          context.LoadAsync();
        }
    
        void context_LoadCompleted(object sender, LoadCompletedEventArgs e)
        {
          Dispatcher.BeginInvoke(delegate
          {
            TagsGrid.ItemsSource = context.SourceCollection;
          });
        }
    
        private void Button_Click(object sender, RoutedEventArgs e)
        {
          // saves any outstanding changes made by the application
          context.SaveChanges();
    
          // refreshes the cache by uploading all modified changes and then by downloading the server changes
          context.CacheController.RefreshAsync();
        }
      }
    }
    
    

    Below is my Server Side Sync Configuration

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <configSections>
            <section name="SyncConfiguration" type="Microsoft.Synchronization.ClientServices.Configuration.SyncConfigurationSection, SyncSvcUtil, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" allowLocation="true" allowDefinition="Everywhere" allowExeDefinition="MachineToApplication" overrideModeDefault="Allow" restartOnExternalChanges="true" requirePermission="true" />
        </configSections>
        <SyncConfiguration>
            <SyncScopes>
                <SyncScope Name="SourceScope" SchemaName="" IsTemplateScope="false"
                    EnableBulkApplyProcedures="false">
                    <SyncTables>
                        <SyncTable Name="[Source]" GlobalName="Source" SchemaName=""
                            IncludeAllColumns="true" FilterClause="">
                            <SyncColumns>
                                <SyncColumn Name="Contact_id" GlobalName="Contact_id" SqlType="int"
                                    IsPrimaryKey="true" IsNullable="false" />
                                <SyncColumn Name="first_name" GlobalName="first_name" SqlType="nvarchar"
                                    IsPrimaryKey="false" IsNullable="false" />
                                <SyncColumn Name="last_name" GlobalName="last_name" SqlType="nvarchar"
                                    IsPrimaryKey="false" IsNullable="false" />
                            </SyncColumns>
                        </SyncTable>
                    </SyncTables>
                </SyncScope>
            </SyncScopes>
            <Databases>
                <TargetDatabase Name="Source" DbServer="IIS08TOPSDEVDB1\IIS08TOPSDEVDB1"
                    DbName="SyncSource" UserName="asapteam" Password="welcome"
                    UseIntegratedAuth="false" />
            </Databases>
        </SyncConfiguration>
    </configuration>

    Below is my Client Side Sync Configuration

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <section name="SyncConfiguration" type="Microsoft.Synchronization.ClientServices.Configuration.SyncConfigurationSection, SyncSvcUtil, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" allowLocation="true" allowDefinition="Everywhere" allowExeDefinition="MachineToApplication" overrideModeDefault="Allow" restartOnExternalChanges="true" requirePermission="true" />
      </configSections>
      <SyncConfiguration>
        <SyncScopes>
          <SyncScope Name="DestinationScope" SchemaName="" IsTemplateScope="false"
            EnableBulkApplyProcedures="false">
            <SyncTables>
              <SyncTable Name="[Source]" GlobalName="Source" SchemaName=""
                IncludeAllColumns="true" FilterClause="">
                <SyncColumns>
                  <SyncColumn Name="Contact_id" GlobalName="Contact_id" SqlType="int"
                    IsPrimaryKey="true" IsNullable="false" />
                  <SyncColumn Name="first_name" GlobalName="first_name" SqlType="nvarchar"
                    IsPrimaryKey="false" IsNullable="false" />
                  <SyncColumn Name="last_name" GlobalName="last_name" SqlType="nvarchar"
                    IsPrimaryKey="false" IsNullable="false" />
                </SyncColumns>
              </SyncTable>
            </SyncTables>
          </SyncScope>
        </SyncScopes>
        <Databases>
          <TargetDatabase Name="Destination" DbServer="IIS08TOPSDEVDB1\IIS08TOPSDEVDB1"
            DbName="SyncDestination" UserName="asapteam" Password="welcome"
            UseIntegratedAuth="false" />
        </Databases>
      </SyncConfiguration>
    </configuration>
    

    NOTE: The service indivisually is working fine.

    Can you guys help me in fixing this. Please free to ask me if you need any more files for viewing or the source code for that matter.

    Wednesday, August 17, 2011 8:01 AM

Answers

All replies

  • Thanks June

    I tried diagnosing the webservice and found this error.

    ClientAccessPolicy.xml/CrossDomain.xml files FAILED Could not find clientaccesspolicy.xml or crossdomain.xml file. Silverlight clients invoking the service from another domain will be unable to make requests successfully.

     

    Any help in this June. Thanks in advance.

    • Proposed as answer by pchiwan Thursday, February 6, 2014 11:10 AM
    Wednesday, August 17, 2011 10:10 AM
  • Wednesday, August 17, 2011 10:31 AM
  • Hi

    I have the same problem.I am struggling since 2 days to fix it .

    My Wcfservice is not hosted in IIS,Running in VS2010

    Asyc() method is fine but when completed() method is calling  I am getting this error .

    I have added the crossdomain.xml and clientaccesspolicy.xml in my project and the project root folder.

    ServiceReferences.ClientConfig

    <configuration>
        <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_IService1" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647">
                        <security mode="None" />
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://localhost:59591/Service1.svc" binding="basicHttpBinding"
                    bindingConfiguration="BasicHttpBinding_IService1" contract="EmployeeService.IService1"
                    name="BasicHttpBinding_IService1" />
            </client>
        </system.serviceModel>
    </configuration>

    Can anyone help me out please?

     

    Thanks

    Chittaranjan

    Monday, December 26, 2011 7:33 AM
  • What I have done is while debugging the application , I just attacted the Wcfservice and It works for me now.(debug->attach Process->attach the wcfservice(for me it was running in the 59591 port)

     

    Thanks

    Chittaranjan

    Monday, December 26, 2011 10:53 AM