简体   繁体   English

Server 2008 R2 64bit上的asmx webservice错误

[英]asmx webservice error on server 2008 r2 64bit

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." 我们有一个asmx Web服务,它可以在32位Windows Server 2008上正常运行,但是当它托管在64位Server 2008 R2计算机上时,它会给出“索引超出数组范围”。 when trying to access the javascript files for the service: 尝试访问服务的javascript文件时:

http://www.site.com/Service.asmx/js outputs "Index was outside the bounds of the array." http://www.site.com/Service.asmx/js输出“索引超出了数组的范围。” only when hosted in 64bit 仅在以64位托管时

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: 和Entry对象:

[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 原来,这与IIS 7.5 <system.webServer /> config节和.axmx的处理程序有关,

<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. 所需要做的就是删除preCondition =“ integratedMode,runtimeVersionv2.0”,它清除了索引超出范围的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM