Ajax enabled WCF Service stops working with Undefined error

Last post 12-17-2009 10:33 AM by LotusShiv. 21 replies.

Sort Posts:

  • Re: Ajax enabled WCF Service stops working with Undefined error

    07-01-2009, 2:58 PM
    • Member
      10 point Member
    • aaminian
    • Member since 06-15-2009, 9:50 PM
    • Posts 9

    Alright, I've found a workaround:


    1.  Create a virtual directory in IIS pointing to the (Ajax-Enabled WCF Service)

         ASP.NET directory of choice (also, make sure .svc extension is mapped to

         aspnet_isapi.dll).


    2.  Change the startup page for your web app by setting the Start URL (Property Pages |

         Start Options) to the one hosted by IIS. So, for instance, if your the page that makes the AJAX WCF

         call is Default.aspx your Start URL will be http://localhost/AjaxWebSite/Default.aspx.  That way, once you

         make any changes to your app, it'll picked up by IIS.


    I believe that the self-hosting functionality in Visual Studio is not bullet-proof when it comes to

    creating/hosting AJAX WCF services on the fly, and that's obviously not the case with IIS.


    This workaround seems to be working for me consistently, at least for now. Tomorrow may be a different story Smile

        

  • Re: Ajax enabled WCF Service stops working with Undefined error

    07-02-2009, 1:32 AM
    • Contributor
      2,342 point Contributor
    • Maulik Patel
    • Member since 12-21-2007, 6:48 AM
    • Ahmedabad
    • Posts 333

    Hello aaminian,

    I am facing same problem. I tried to do what you explained above but still facing same problem. Your first point is pretty clear. I set virtual directory in IIS and also checked .svc is mapped to aspnet_isapi.dll.

    Second point is little confusing for me. Can you explain it in detail ? I also started new thread for my problem if you wish to post your answer to my thread.

    http://forums.asp.net/t/1442084.aspx

    Thanks in advance.

    Maulik Patel
    MCTS, Software Engineer

    Don't forget to click "Mark as Answer" on the post that helped you. This will give you point and help readers to know which post solved your issue and make their search easy.
  • Re: Ajax enabled WCF Service stops working with Undefined error

    07-16-2009, 4:40 PM
    • Member
      10 point Member
    • aaminian
    • Member since 06-15-2009, 9:50 PM
    • Posts 9

    Hi Patel,


    Sorry for the late response.  I usually get an email when someone updates a post but I didn't in this case!


    Anyhow, here is what I meant:

    1.  Right click on your ASP.NET application and select "Property Pages" at the bottom of the displayed context menu.

    2.  On the Property Pages form, select the "Startup Options" on the tree pane.

    3.  Select the "Start URL" radio button on the right (form) pane and put your url in the now-enabled text box; e.g., http://localhost/AjaxWebSite/Default.aspx


    I hope that helps,

    Alex

  • Re: Ajax enabled WCF Service stops working with Undefined error

    07-18-2009, 4:53 AM
    • Contributor
      2,342 point Contributor
    • Maulik Patel
    • Member since 12-21-2007, 6:48 AM
    • Ahmedabad
    • Posts 333

    Hi Alex,

    Thanks for your asnswer. Will try your suggestion. And will let you know if any problem.

    Maulik Patel
    MCTS, Software Engineer

    Don't forget to click "Mark as Answer" on the post that helped you. This will give you point and help readers to know which post solved your issue and make their search easy.
  • Re: Ajax enabled WCF Service stops working with Undefined error

    12-14-2009, 12:37 PM
    • Member
      4 point Member
    • LotusShiv
    • Member since 12-14-2009, 12:02 PM
    • Posts 2

    I have the ScriptReference just as you specify above. Also for now, I don't have any functions in a separate js file which call any of the wcf (js proxy - function) .

    So in my Search.aspx (in the HTML markup area) I have as follows:

    <asp:ScriptManager ID="ScriptManager1" runat="server">
                <Scripts>
                    <asp:ScriptReference Path="~/Javascript/WCFSearchAE.js" />
                </Scripts>
    </asp:ScriptManager>

    But my main issue is even for test purposes for e.g. on IE 7 in the browser when I type

     localhost/WCFServiceAE/WCFSearchAE.svc/MethodName1

    I get the following error - Method not allowed.

    This makes it seem like it is a config issue? Any help is greatly appreciated. Here is my WCF AJAX enabled service config - Service Model part of it (from web.config)

    <system.serviceModel>
          <behaviors>
            <serviceBehaviors>
              <behavior name="mexBehavior">
                <serviceMetadata httpGetEnabled="true" />
              </behavior>
            </serviceBehaviors>
            <endpointBehaviors>
              <behavior name="EndpointBehavior">
                <enableWebScript/>
              </behavior>
            </endpointBehaviors>
          </behaviors>
          <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
          <services>
            <service behaviorConfiguration="mexBehavior" name="WCFAEService.WCFSearchAE">
              <endpoint address="" binding="webHttpBinding" behaviorConfiguration="EndpointBehavior"
                        bindingConfiguration="" contract="WCFAEService.IWCFSearchAE" />
              <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            </service>
          </services>
        </system.serviceModel>

    Please point me in the right direction.

     

     

    Filed under: , ,
  • Re: Ajax enabled WCF Service stops working with Undefined error

    12-16-2009, 7:07 PM
    • Contributor
      2,908 point Contributor
    • anup1252000
    • Member since 11-12-2008, 8:26 AM
    • india
    • Posts 573

    just enable  tracing and check what error u re getting. got through this article

    http://blogs.msdn.com/madhuponduru/archive/2006/05/18/601458.aspx

    Remember to click “Mark as Answer” on the post, if it helps you. Because It helps others to find the solution.

    Anup Hosur
    HP
    http://anup-anuphosur.blogspot.com/


  • Re: Ajax enabled WCF Service stops working with Undefined error

    12-17-2009, 10:33 AM
    • Member
      4 point Member
    • LotusShiv
    • Member since 12-14-2009, 12:02 PM
    • Posts 2

    I am trying to consume AJAX enabled WCF service as a javascript proxy in my ASP.Net 3.5 website - I have a search.aspx where I have added the proxy as <scripts>...</scripts> in the ScriptManager markup area. I did create the javascript proxy after I deployed the msi for my WCF service by typing in the IE browser as localhost/...svc/jsdebug and give an appropriate name when the file dialog shows up. All that is fine and I am even able to just plain run the method within by doing localhost/...svc/Method1?xmlInput=<Auth>....</Auth> and
    get the results appropriately and there is no issue there. The problem is when I call it from the client side code in my javascript onclick handler for a button on the page, I still dont get any error per say, but after Sys.Net.WebServiceProxy.invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, this.get_timeout()); is called in the Sys$Net$WebServiceProxy$_invoke (AJAX generated method), the result is blank in the onComplete method and instead the errorObj gets set with the statusCode being 12030.

       I did use the blog that you suggested to set up the tracing in both the web.config files i.e. in the service web.config and on the website web.config. Only the service log file gets created and I dont see any error related information. I appreciate your response in this regard

Page 2 of 2 (22 items) < Previous 1 2