We have an asmx web service that works fine on a 32bit windows server 2008 but when it is hosted on a 64bit server 2008 r2 machine it gives a "Index was outside the bounds of the array." when trying to access the javascript files for the service:
http://www.site.com/Service.asmx/js outputs "Index was outside the bounds of the array." only when hosted in 64bit
Here is what the service code looks like:
[WebService(Namespace = "http://www.company.com")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
[ScriptService]
public class Saver : WebService
{
/// <summary>A web service to save a set of ScheduleEntryProperties objects.</summary>
[WebMethod]
public string SaveEntries(Entry[] entries, object start, object end, string assignmentIDs, string deptID, string useCodes)
{
...
}
And the Entry object:
[Serializable]
public class Entry
{
public Entry()
{
}
public Entry(object assignmentID, object date, object hours, object text)
{
AssignmentID = assignmentID;
Date = date;
Hours = hours;
Text = text;
}
public object Date;
public object AssignmentID;
public object Text;
public object Hours;
}
Any ideas?
Turns out this has to do with IIS 7.5 <system.webServer />
config section and handler for .axmx that was defined as
<add name="*.asmx_*" path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode,runtimeVersionv2.0" />
all that was needed was to remove preCondition="integratedMode,runtimeVersionv2.0" and it cleared up the index out of bounds error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.