I can't get remoting to work with Zafir & Asp.net.

I've setup webconfig and added all the Zafir dlls (is there a Nuget package?). But I keep getting an "Invalid Character" error when parsing JSON (WebShaper.Main.js:351). It makes the rpc request, but rather than executing the rpc method it returns the main webpage and tries to parse it as json...

Am I missing something in the configuration?

  • fradav

    I think that if you start a fresh project from the template, you shouldn't encounter this problem. With the provided zafir template for asp.net container ("client-server application") the web.config is already configured for remoting. And it adds the required nuget packages out of the box (they got the same names as before only prefixed by "zafir" instead of "websharper").

    • Ray nxs7

      Sorry for the delay...
      Unfortunately, I have to use an ASP.net(C#/razor with signalr) main project that references a W#/F# dll.

      I think the problem may be that I'm using an MVC.Controller to serve up the main page (so http://foo.com/App/Main calls AppController.Main() which returns an html page). Now the RPC code uses "http://foo.com/App/Main?" to request stuff from the server and always returns the main page html...

      The websharper docs say I should use

        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
            filters.Add(new WebSharper.AspNetMvc.Filter());

      But I can't find a zafir version of the WebSharper.AspNetMvc dll. Do I still need it?

    • Ray nxs7

      I got it to work. Don't need WebSharper.AspNetMvc.