2

I can call the webservie directly to the browser with the following URL and it returns be all what I want :

http://localhost:64438/MySearchAutoComplete.asmx/GetCompletionList

When I add it to an autocompleteexetender into the Default.aspx page like that :

<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" 
                  TargetControlID="TextBox1" 
                  runat="server" 
                  ServiceMethod="GetCompletionList" 
                  ServicePath="http://localhost:64438/MySearchAutoComplete.asmx" 
                  CompletionSetCount="12"
                  MinimumPrefixLength="1" />

The page load, I have a textbox but I have an error 500 every time I add a keystroke in the textbox. I see the error in the FireFox FireBug.

http://localhost:62702/   --->This is the webpage that load fine 

alt text --> This is the error

Any idea? I have noticed that I need to attach the process to debug the webservice, I might do something wrong with it too?

Edit (Event Viewer)

If I go to the Event Viewer of my machine. I can see :

Exception information: 
    Exception type: InvalidOperationException 
    Exception message: Request format is unrecognized for URL unexpectedly ending in '/GetCompletionList'. 


    Thread information: 
    Thread ID: 8 
    Thread account name: MTL\daok 
    Is impersonating: False 
    Stack trace:    at     System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
   at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath)
   at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
   at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I also have to start the webservice project first, than I stop it and start the webproject to be able to have both. The webservice still works (I can fire it directly http://localhost:64438/MySearchAutoComplete.asmx?op=GetCompletionList) but on the webpage I still have that Error 500.

Edit 2 (Web.config)

Adding to the webservice project web.config:

  <webServices>
    <protocols>
      <add   name="HttpGet"/>
      <add   name="HttpPost"/>
    </protocols>
  </webServices>

Have not solve the problem.

Edit 3 (Direct call)

Calling in the Page_Load() the same method from the WebService work very well:

     string[] stuffs;
     stuffs = proxy.GetCompletionList("1", 10);
     MyList.DataSource = stuffs;
     MyList.DataBind();

But it's not working with the AutoCompleteExtender...

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Patrick Desjardins
  • 136,852
  • 88
  • 292
  • 341

2 Answers2

6

In the event log on the webserver (i.e. your local machine) it should give a more detailed error message.

Add this to your web.config I think

<webServices>
    <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
    </protocols>
</webServices>
Martin Smith
  • 438,706
  • 87
  • 741
  • 845
  • All is still in Visual Studio. It has not been deployed. – Patrick Desjardins Mar 24 '10 at 17:29
  • Alright this is what I see: InvalidOperationException Request format is unrecognized for URL unexpectedly ending in '/GetCompletionList'. http://localhost:64438/MySearchAutoComplete.asmx/GetCompletionList /MySearchAutoComplete.asmx/GetCompletionList – Patrick Desjardins Mar 24 '10 at 17:32
  • I have the same problem. Could this be how the webservice is refered. For instance, I have to set the webservice as Startup project first, than I stop and Set the startup project as the web project. Doing this ensure that the webservice is running. In my memory, in the past, I had just to start the webservice and everything was up... – Patrick Desjardins Mar 24 '10 at 17:47
  • Did you try adding the stuff to the web.config as per that thread? – Martin Smith Mar 24 '10 at 17:49
  • The web.config of the WebService is pretty blank. The one from the Web Page has all "normal" tag that is required for Asp.Net Ajax stuff. – Patrick Desjardins Mar 24 '10 at 17:51
  • Then you need to add that stuff to tell it to allow HTTP post. – Martin Smith Mar 24 '10 at 17:53
  • I added it after you told me :) – Patrick Desjardins Mar 24 '10 at 17:55
  • Same behavior, same logging message. – Patrick Desjardins Mar 24 '10 at 17:57
  • Exception message: Request format is unrecognized for URL unexpectedly ending in '/GetCompletionList'. – Patrick Desjardins Mar 24 '10 at 17:57
  • That should have fixed it according to http://stackoverflow.com/questions/654099/how-do-i-fix-a-request-format-is-unrecognized-for-url-error-in-a-web-servic and http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/0a47bb81-cb23-4cb0-bee5-2fa7813d05d6 as well! – Martin Smith Mar 24 '10 at 18:04
0

Just ensure you uncomment [System.Web.Script.Services.ScriptService] just below the WebServiceBinding at the top of the web service class page.

That should get it solved. If it still persist, please check the URL of your SitePath making sure it is correctly rooted to the location of the webservice by including "~" before the URL as show below:

SitePath="~/Webservice.asmx"
PopGlintz
  • 15
  • 4