views:

436

answers:

1

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...

+1  A: 

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
All is still in Visual Studio. It has not been deployed.
Daok
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
Daok
Looks like same issue as this thread http://forums.asp.net/p/988377/1278431.aspx
Martin Smith
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...
Daok
Did you try adding the <webServices> <protocols>stuff to the web.config as per that thread?
Martin Smith
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.
Daok
Then you need to add that stuff to tell it to allow HTTP post.
Martin Smith
I added it after you told me :)
Daok
And any progress?
Martin Smith
Same behavior, same logging message.
Daok
Exception message: Request format is unrecognized for URL unexpectedly ending in '/GetCompletionList'.
Daok
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
Trust me I would like it to works, but it doesn't.
Daok
+1 for the help. I'll continue to search
Daok