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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:04:11+00:00 2026-06-02T04:04:11+00:00

I am having an issue with a WCF service working correctly. I am trying

  • 0

I am having an issue with a WCF service working correctly. I am trying to create a duplex service but evertime I try to return a custom datatype it breaks the client side.

If I remove GetTestData everything works fine. When I add it everything breaks on the client side. It seems like I can fix it by unchecking “Reuse types in referenced assemblies”, but I am not sure if there are negative side effects in doing this.

Here is the code

ITestService.cs

namespace MyApp.Server
{
    [ServiceContract(Namespace = "http://www.mysite.net", CallbackContract = typeof(IDuplexTestClient))]
    public interface ITestService
    {
        [OperationContract]
        string Hello();

        [OperationContract]
        TestData GetTestData();
    }

    public interface IDuplexTestClient
    {
        [OperationContract(IsOneWay = true)]
        void TestCallback(string message);
    }
}

TestService.cs

namespace MyApp.Server
{
    [ServiceBehavior(Namespace = "http://www.mysite.net")]
    public class TestService : ITestService, ICrossDomainPolicyResponder
    {
        public string Hello()
        {
            return "Hello";
        }

        public TestData GetTestData()
        {
            return new TestData();
        }

        #region ICrossDomainPolicyResponder Members
        public Stream GetSilverlightPolicy()
        {
            string result = @"<?xml version=""1.0"" encoding=""utf-8""?>
                <access-policy>
                    <cross-domain-access>
                        <policy>
                            <allow-from http-request-headers=""*"">
                                <domain uri=""*""/>
                            </allow-from>
                            <grant-to>
                                <resource path=""/"" include-subpaths=""true""/>
                            </grant-to>
                        </policy>
                    </cross-domain-access>
                </access-policy>";
            return StringToStream(result);

        }

        public Stream GetFlashPolicy()
        {
            string result = @"<?xml version=""1.0""?>
                            <!DOCTYPE cross-domain-policy SYSTEM ""http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"">
                            <cross-domain-policy>
                                <allow-access-from domain=""*"" />
                            </cross-domain-policy>";
            return StringToStream(result);
        }

        private Stream StringToStream(string result)
        {
            WebOperationContext.Current.OutgoingResponse.ContentType = "application/xml";
            return new MemoryStream(Encoding.UTF8.GetBytes(result));
        }
        #endregion
    }
}

TestData.cs

namespace MyApp.SDK 
{
    [DataContract(Namespace = "http://www.mysite.net")]
    public class TestData
    {
        [DataMember]
        public string TestString { get; set; }
    }
}
  • 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-06-02T04:04:12+00:00Added an answer on June 2, 2026 at 4:04 am

    I’m still not 100% sure what is going on here but I found a solution that works for me. I am able to use the “Reuse types in specified referenced assemblies” to get the functionality I need. This fixed the problem but still allows me to share the MyApp.SDK classes between the client and server.

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

Sidebar

Related Questions

Hi All I am currently having an issue calling a WCF service from a
I am having a configuration issue with a server trying to get WCF services
I'm having an odd issue where it seems my WCF service is being called
I’m having an issue using ADFS2 to secure a back-end WCF service that is
I am having a problem when I try to browse WCF service (.svc file)
I am having time out issue in WCF. The following is the error: {The
I having issue that content assistant / intellisense is working in methods such as
Having an issue with random individuals trying to access an intranet site with a
Having an issue here that I have tried everything I can think of but
Having an issue with traversing in jQuery.. hopfully an easy one..but I'm banging my

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.