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

  • Home
  • SEARCH
  • 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 799743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:10:46+00:00 2026-05-14T23:10:46+00:00

I have to use Sync Framework 2.0 in our WPF app that will contain

  • 0

I have to use Sync Framework 2.0 in our WPF app that will contain SQL Compact 3.5 and will synchronize with SQL Server 2008.

I followed this video : http://download.microsoft.com/download/6/7/3/6730f0e7-a649-4656-96ab-150c7501a583/IntroToSyncServicesADODetNet_HighQuality.wmv.

But instead DataSet I’ve used EntityFramework 4.0 and C#.

I’m very interested in code auto generation by adding Local Database Cache file with extension sync. It is great, and I can modify code in my partial class to change base functionality.

Everything works grate when I have code for client and server place in WPF application.

Everything works grate when I use WCF Class Library that contains server synchronization logic.

But… In the following example they show us how to run solution and host WCF in local "WCF Host" only on my computer.

The first question is:

"How can I create instance of class from WCF Class Library that contains all server synchronization logic and then host it and expose in ASP.NET MVC 2.0 application."

The most important thing is to keep this *.sync files and don’t write all the code manually it gives me the option to automatically update this code when database schema would change.

The second question is:

"How can I configure endpoints and behaviors for this instance of WCF Class Library in my web.config when it has its on app.config in class library?…"

Unfortunately wizard for *.sync files only sees local WPF application, or WCF Class Library, I can’t choose directly ASP.NET MVC 2.0 (it would be great) to generate class for synchronization in web app.

I would be very pleased to see working example.

Regards,
Daniel Skowroński

  • 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-14T23:10:47+00:00Added an answer on May 14, 2026 at 11:10 pm

    Solution to create WCF Class Library instance with synchronization logic hosted in ASP.NET MVC 2.0:

    • follow http://download.microsoft.com/download/6/7/3/6730f0e7-a649-4656-96ab-150c7501a583/IntroToSyncServicesADODetNet_HighQuality.wmv to create WCF Class Library

    • create ASP.NET MVC 2.0 App and add WCF Service

    • delete C# file *.cs behind *.svc

    • add Project Referece from ASP.NET projet to WCF Class Library

    • edit your *.svc file in ASP.NET

    here you will see something like:

     <%@ ServiceHost Language="C#" Debug="true" Service="namespace-assembly.class" CodeBehind="filename.svc.cs" %>
    

    where Service is Factory method that will create instance of “namespace-assembly.class” so, you have to change this to “wcf_librrary_namespace-assembly.****DataCacheSyncService” and CodeBehind to “wcf_librrary_namespace-assembly.filename.cs”

    • next modify wcf instance in WCF Class Library that will enable hosting it with the same credentials as asp.net app, simply add : [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] attribute

    • next configure web.config:

      <service name="asp.net-namespace.wcf_service_name" behaviorConfiguration="service_nameBehavior">
        <host>
           <baseAddresses>
              <add baseAddress="http://ipaddres/asp.net-app-name/service-name.svc" />
           </baseAddresses>
        </host>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <endpoint address=""  binding="basicHttpBinding" contract="wcf_librrary_namespace assembly.I****DataCacheSyncContract" />
      </service>
      
      <behavior name="service_nameBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
      

    add also

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
    

    below

    <system.serviceModel>
    
    • now simply publish it to your server and create ASP.NET app

    • now add Service Reference to your Client Application

    • here we have problem that when you will execute:

      **DataCacheSyncAgent syncAgent = new **DataCacheSyncAgent(new **DataCacheSyncContractClient());

    Microsoft.Synchronization.Data.SyncStatistics syncStats = syncAgent.Synchronize();

    You will probably get Exception: “Cannot convert type ** to Microsoft.Synchronization.Data.SyncGroupMetadata, One solution to resolve this issue for now that I’ve found is to expand your service reference and b CTR+H rename all “asp-net-assembly-SyncGroupMetadata” and other similar files to “Microsoft.Synchronization.Data.SyncGroupMetadata” etc.

    • Now synchronization should start

    HTH

    Regards,

    Daniel Skowroński

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.