The ASP.Net with C# Project was developed by VS2005 and run under Windows Server2003 with IIS6.
As we are planning for Hardware upgrade, we tried to move the project to VS2012 with .Net4.0 and IIS7.
The convertion of solution from VS2005 to VS2012 with .Net4.0 and delopying to IIS7 was smooth. The Website is running fine under IE9 except the WebMethod call from javascript is throwing error with message: 500-The server method “LookupTest” failed.
That’s the WebMethod part:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class LookupMethods : System.Web.Services.WebService
{
[WebMethod]
[System.Web.Script.Services.ScriptMethod]
public UNLookupResult LookupTest(int objectID)
{
return new UNLookupResult();
}
}
JavaScript call to the WebMethod:
this._WebRequest = Sys.Net.WebServiceProxy.invoke(this._SearchPath, "LookupContractTest", false, { "objectID":20 }, Function.createDelegate(this, this.LookupComplete), Function.createDelegate(this, this.LookupError));
- The LookupTest function cannot be invoked when I’m debugging the program under IIS7.
- If i modify the LookupTest function to take no parameter, it is running fine without any error. like that: public UNLookupResult LookupTest()
- The project is using AjaxControlToolkit.dll v1.1. Will it be a problem if the project using .Net4.0?
any hint or suggestion? Thanks in advance.
There are a few changes required in the web.config when you migrate from IIS6 to IIS7.
This is the most likely cause of your problem.
In IIS7 will not read your
<httpHandlers>and<httpModules>.You will need to configure them for IIS7 as follows:
Refer: Configuring Asp.net AJAX
In the absence of these, your web service proxies will not work correctly.
You can use fiddler to inspect the request and verify that it is valid.