Xaml parse exception is thrown when i define a duplex contract

Posted by Yaroslav on Stack Overflow See other posts from Stack Overflow or by Yaroslav
Published on 2010-04-04T19:33:00Z Indexed on 2010/04/04 19:33 UTC
Read the original article Hit count: 398

Filed under:
|
|
|
|

Hi! I've got a WPF application containing a WCF service.

The Xaml code is pretty simple:

Enter your text here Send Address:

Here is the service:

namespace WpfApplication1 {

[ServiceContract(CallbackContract=typeof(IMyCallbackContract))]
public interface IMyService
{
    [OperationContract(IsOneWay = true)]
    void NewMessageToServer(string msg);

    [OperationContract(IsOneWay = true)]
    bool ServerIsResponsible();

}



[ServiceContract]
public interface IMyCallbackContract
{
    [OperationContract]
    void NewMessageToClient(string msg);

    [OperationContract]
    void ClientIsResponsible();

}


/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>


       public partial class Window1 : Window
     {


           public Window1()
         {


        InitializeComponent();

        ServiceMetadataBehavior behavior = new
        ServiceMetadataBehavior();
        //behavior.HttpGetEnabled = true;

        //behavior.
        ServiceHost serviceHost = new
        ServiceHost(
        typeof(MyService),
        new Uri("net.tcp://localhost:8080/"));

        serviceHost.Description.Behaviors.Add(behavior);

        serviceHost.AddServiceEndpoint(
            typeof(IMetadataExchange),
            MetadataExchangeBindings.CreateMexTcpBinding(),
            "mex");

        serviceHost.AddServiceEndpoint(
            typeof(IMyService),
            new NetTcpBinding(),
            "ServiceEndpoint");

            serviceHost.Open();
            MessageBox.Show(
                "server is up");

       //  label1.Content = label1.Content + String.Format("   net.tcp://localhost:8080/");
        }

      }

       public class MyService : IMyService
       {
           public void NewMessageToServer(string msg)
           {

           }

           public bool ServerIsResponsible()
           {
               return true;
           }

       }

}

I am getting a Xaml parse exception in Line 1, what can be the problem? Thanks!

© Stack Overflow or respective owner

Related posts about xaml

Related posts about exception