This project is read-only.

Unknown application token for Service Method

Mar 31, 2011 at 11:33 PM


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()

            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(result[0] + "/n" + result[1]);

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"))

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?

Apr 1, 2011 at 1: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.