Unknown application token for Service Method

Mar 31, 2011 at 10:33 PM

Hi!

I'm manking some tests with your application framework but, when I'm calling a method in silverlight from the WCF service, I did this:

 

 public MainPage()
        {
            InitializeComponent();

            VirtualChannel<IHelloService>.Initialize(new System.ServiceModel.EndpointAddress("http://localhost:999/services/ServiceModel.Service.HelloService.svc"), "smart");

            IList<string> result = new List<string>();

            VirtualChannel<IHelloService>.InvokeFuncAsync<IList<string>>("SayHelloLoggedOut", (resultService, error) =>
                {
                    if (error != null)
                    {
                        MessageBox.Show(error.ToString());
                        return;
                    }
                    result.Add(resultService[0]);
                    result.Add(resultService[1]);
                    MessageBox.Show(result[0] + "/n" + result[1]);
                },"Guto");
            
        }

Where "smart" is my token.

My service is registred on Global.asax this way:

void Application_Start(object sender, EventArgs e)
        {
            VirtualServiceProvider.Initialize(new VirtualServiceContext() 
            {
                RequiresSSL = false,
                VirtualServiceToken = "smart"
            
            });
            //if (!VirtualServiceProvider.IsRegistered("~/services"))
            //{
                VirtualServiceProvider.Register("services");                
            //}
            
        }

So, when I call the InvokeFuncAsync method on VirtualChannel, it just throws me this exception:

{"Unknown application token for Service Method [SayHelloLoggedOut] on Service Type [ServiceModel.Service.HelloService]. Url: [http://localhost:999/services/ServiceModel.Service.HelloService.svc] Referrer: [http://localhost/ServiceModel.Client.Web/ClientBin/ServiceModel.Client.xap]"}
Well, the token is correct on both sideas as you can see, but I still cant call the methods.
 
Is there any way to I can fix it?
Thanks!
Gutemberg 
 

Coordinator
Apr 1, 2011 at 12:29 PM

Sorry for the delayed response. Question, have you applied the BypassAuthentication attribute to your method? If not then you will get this until you authenticate the calling user. The authentication relies on the HttpContext User Identity to determine if the current user is authenticated/authorized.

Let me know if you need more info, happy to help.