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
--> 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, HttpRes开发者_运维百科ponse 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...
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>
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"
精彩评论