400错误请求的Web服务响应

时间:2011-10-21 11:15:24

标签: asp.net web-services

我在ASP .Net 4.0中有一个标准的web服务,定义如下:

       [WebMethod]
        public string MyWebServiceRequest(string data)
        {
           //Code
        }

字符串的大小约为10K字节,当尝试发送到此Web服务时,我收到400 Bad Request。如果我只发几行就可以了。

据我所知,默认最大大小约为65KB,或者我错了?我在事件查看器中没有出现错误,等等。有没有办法强制记录Web服务的错误?

更新: 如果这可能导致我的问题,是否有任何限制允许你在字符串中使用?

以下是我要求发送的实际数据的请求。就像一个笔记我已经设法通过删除其中一行来发送它,我不明白为什么这一行会使请求失败。

Score Lines then - Is Arrow, NS Pair, EW Pair, NS Score, Round
            NoSlam Tricks(+ or -, 6 or 7), Points NS & EW, Adjustments NS &
            EW, Penalties NS & EW, Contract, By, TricksMade, Lead,
            Table,Spare

整个XML请求

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:Body>
        <tns:xTournamentResultDatFile
            xmlns:tns="http://www.mywebsite.com/">
            <!-- Zero or one occurrences -->
            <tns:datFile>
                Version,8 ID1 - Type, Date Serial, Description, Section, Web
                File Name, Sessions P,40805,,,2011sep19.htm,1 ID2 - BridgeMate,
                IsStratified, 3x spares 0,0,0,0,0 Profile Tables, NTotal,
                ETotal, Pairs, Is 2 Winners, Min Details, ScoreMethod, Color
                5,5,5,10,-1,0,0,0 Swiss, E_Individual,Teams BPM Stored,0,0,0 Is
                VPs, VPs are Stored, Is Teams Travellers 0,0,0 Is Done -
                Movement, Tables, Sheets -1,-1,-1 Teams Entered as Imps, Teams
                Boards, Boards Per Set,-1,25,5 Results - pair number then 2 x
                Player Nos, Score, G Slams, S Slams Master Points, Orientation,
                Score, Score Divisor,Handicap, 2 x Player Names,Green Points
                Score Lines Count,Green Point, Is Handicapped, V3,10,0,0
                3,9,10,5400,0,0,25,N,108,200,0,Player Nine,Player Ten 0
                2,5,6,5050,0,0,10,N,101,200,0,Player Five,Player Six 0
                5,17,18,5050,0,0,10,N,101,200,0,Player Seventeen,Player Eighteen
                0 1,1,2,5000,0,0,0,N,100,200,0,Player One,Player Two 0
                4,13,14,4500,0,0,0,N,90,200,0,Player Thirteen,Player Fourteen 0
                7,7,8,7000,0,0,25,E,140,200,0,Player Seven,Player Eight 0
                10,19,20,5100,0,0,13,E,102,200,0,Player Nineteen,Player Twenty 0
                9,15,16,4700,0,0,0,E,94,200,0,Player Fithteen,Player Sixteen 0
                6,3,4,4250,0,0,0,E,85,200,0,Player Three,Player Four 0
                8,11,12,3950,0,0,0,E,79,200,0,Player Elven,Player Twelwe 0 ESE
                MPs Auto Calc,0 Master Points - Awarded, Printed, e File Serial,
                Serial Start, Hand Title, Spare 10,0,0,0,,S Master Pointing
                Score Level, CBAI Club Factor,1,0 Is a Qualifinal,
                Tables,#FALSE#,0 SABF - Grading, Is Closed, Is Mixed,0,0,0 No
                MPs For Event,0 SMPC Adjustment Method,
                E_ABFRestricted,E_ABFMFactor ,1,0,1 Table Allocations,5 N/S
                Pair, E/W Pair,4 x Player numbers, 2 x Spares 1,6,1,2,3,4,S,S
                2,7,5,6,7,8,S,S 3,8,9,10,11,12,S,S 4,9,13,14,15,16,S,S
                5,10,17,18,19,20,S,S Movement Not New Move, Name,
                Type,-1,Straight Mitchell - Boards Down, Pairs Up,M Board Sets,
                Boards Per Set, Max Rounds, Rounds Missed, Round 1 Not Played
                5,5,5,0,0 Missing Pair No, Missing Pair is NS, Pair Numbers
                Duped, EW Pair No Offset 0,0,-1,5 Is a Rover, Rover Table No,
                Rover Is NS, Standard Rover 0,0,0,0 Feed In Table, Boards Down
                1,0,0 Mitchell Skip Early +4 Spares,0,S,S,S,S Arrow Count,0
                Score Sheets Is NSNumbered, Are Slams, Butler Scoring Exclusions
                -1,0,1 Expected Min Score Lines, SMPC, Max Score Lines 5,-1,5
                Aggregate UpperLimit,1000 Order SS By Score, No Score Check &
                Spare,0,0,S Sheet Count 2,25 Show Contract,spare, spare,0,0,0
                Score Lines then - Is Arrow, NS Pair, EW Pair, NS Score, Round
                NoSlam Tricks(+ or -, 6 or 7), Points NS & EW, Adjustments NS &
                EW, Penalties NS & EW, Contract, By, TricksMade, Lead,
                Table,Spare 5 0,1,1,50,1,0,4,4,-1,-1,0,0,, ,0,,1,0
                0,2,3,100,5,0,7,1,-1,-1,0,0,, ,0,,2,0
                0,3,5,100,4,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,2,-420,3,0,1,7,-1,-1,0,0,, ,0,,4,0
                0,5,4,-420,2,0,1,7,-1,-1,0,0,, ,0,,5,0 5
                0,1,1,500,1,0,3,5,-1,-1,0,0,, ,0,,1,0
                0,2,3,500,5,0,3,5,-1,-1,0,0,, ,0,,2,0
                0,3,5,620,4,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,2,620,3,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,4,-100,2,0,0,8,-1,-1,0,0,, ,0,,5,0 5
                0,1,1,140,1,0,4,4,-1,-1,0,0,, ,0,,1,0
                0,2,3,140,5,0,4,4,-1,-1,0,0,, ,0,,2,0
                0,3,5,140,4,0,4,4,-1,-1,0,0,, ,0,,3,0
                0,4,2,-50,3,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,4,170,2,0,8,0,-1,-1,0,0,, ,0,,5,0 5
                0,1,1,-170,1,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,3,-170,5,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,5,-170,4,0,5,3,-1,-1,0,0,, ,0,,3,0
                0,4,2,-620,3,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,4,-170,2,0,5,3,-1,-1,0,0,, ,0,,5,0 5
                0,1,1,600,1,0,3,5,-1,-1,0,0,, ,0,,1,0
                0,2,3,600,5,0,3,5,-1,-1,0,0,, ,0,,2,0
                0,3,5,600,4,0,3,5,-1,-1,0,0,, ,0,,3,0
                0,4,2,600,3,0,3,5,-1,-1,0,0,, ,0,,4,0
                0,5,4,630,2,0,8,0,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,-620,2,0,3,5,-1,-1,0,0,, ,0,,1,0
                0,2,2,-620,1,0,3,5,-1,-1,0,0,, ,0,,2,0
                0,3,4,-600,5,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,1,-630,4,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,3,-600,3,0,7,1,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,-100,2,0,2,6,-1,-1,0,0,, ,0,,1,0
                0,2,2,-100,1,0,2,6,-1,-1,0,0,, ,0,,2,0
                0,3,4,-100,5,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,1,140,4,0,8,0,-1,-1,0,0,, ,0,,4,0
                0,5,3,110,3,0,6,2,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,420,2,0,4,4,-1,-1,0,0,, ,0,,1,0
                0,2,2,420,1,0,4,4,-1,-1,0,0,, ,0,,2,0
                0,3,4,420,5,0,4,4,-1,-1,0,0,, ,0,,3,0
                0,4,1,420,4,0,4,4,-1,-1,0,0,, ,0,,4,0
                0,5,3,420,3,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,420,2,0,1,7,-1,-1,0,0,, ,0,,1,0
                0,2,2,420,1,0,1,7,-1,-1,0,0,, ,0,,2,0
                0,3,4,450,5,0,5,3,-1,-1,0,0,, ,0,,3,0
                0,4,1,450,4,0,5,3,-1,-1,0,0,, ,0,,4,0
                0,5,3,480,3,0,8,0,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,-140,2,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,2,-140,1,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,4,-170,5,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,1,-110,4,0,8,0,-1,-1,0,0,, ,0,,4,0
                0,5,3,-200,3,0,0,8,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,300,3,0,6,2,-1,-1,0,0,, ,0,,1,0
                0,2,1,110,2,0,4,4,-1,-1,0,0,, ,0,,2,0
                0,3,3,1400,1,0,8,0,-1,-1,0,0,, ,0,,3,0
                0,4,5,-50,5,0,1,7,-1,-1,0,0,, ,0,,4,0
                0,5,2,-50,4,0,1,7,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,170,3,0,1,7,-1,-1,0,0,, ,0,,1,0
                0,2,1,170,2,0,1,7,-1,-1,0,0,, ,0,,2,0
                0,3,3,620,1,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,5,620,5,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,2,600,4,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,-100,3,0,7,1,-1,-1,0,0,, ,0,,1,0
                0,2,1,-100,2,0,7,1,-1,-1,0,0,, ,0,,2,0
                0,3,3,-170,1,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,5,-200,5,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,2,-140,4,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,500,3,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,1,500,2,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,3,690,1,0,8,0,-1,-1,0,0,, ,0,,3,0
                0,4,5,420,5,0,1,7,-1,-1,0,0,, ,0,,4,0
                0,5,2,420,4,0,1,7,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,-100,3,0,3,5,-1,-1,0,0,, ,0,,1,0
                0,2,1,140,2,0,7,1,-1,-1,0,0,, ,0,,2,0
                0,3,3,-100,1,0,3,5,-1,-1,0,0,, ,0,,3,0
                0,4,5,140,5,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,2,-200,4,0,0,8,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,170,4,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,5,170,3,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,2,170,2,0,5,3,-1,-1,0,0,, ,0,,3,0
                0,4,4,140,1,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,1,170,5,0,5,3,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,450,4,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,5,450,3,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,2,300,2,0,0,8,-1,-1,0,0,, ,0,,3,0
                0,4,4,420,1,0,2,6,-1,-1,0,0,, ,0,,4,0
                0,5,1,480,5,0,8,0,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,140,4,0,6,2,-1,-1,0,0,, ,0,,1,0
                0,2,5,-110,3,0,1,7,-1,-1,0,0,, ,0,,2,0
                0,3,2,-110,2,0,1,7,-1,-1,0,0,, ,0,,3,0
                0,4,4,140,1,0,6,2,-1,-1,0,0,, ,0,,4,0
                0,5,1,140,5,0,6,2,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,460,4,0,6,2,-1,-1,0,0,, ,0,,1,0
                0,2,5,460,3,0,6,2,-1,-1,0,0,, ,0,,2,0
                0,3,2,430,2,0,1,7,-1,-1,0,0,, ,0,,3,0
                0,4,4,460,1,0,6,2,-1,-1,0,0,, ,0,,4,0
                0,5,1,430,5,0,1,7,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,600,4,0,7,1,-1,-1,0,0,, ,0,,1,0
                0,2,5,-100,3,0,2,6,-1,-1,0,0,, ,0,,2,0
                0,3,2,-100,2,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,4,600,1,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,1,-100,5,0,2,6,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,110,5,0,6,2,-1,-1,0,0,, ,0,,1,0
                0,2,4,130,4,0,8,0,-1,-1,0,0,, ,0,,2,0
                0,3,1,-170,3,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,3,-420,2,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,5,-150,1,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,400,5,0,2,6,-1,-1,0,0,, ,0,,1,0
                0,2,4,400,4,0,2,6,-1,-1,0,0,, ,0,,2,0
                0,3,1,430,3,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,3,430,2,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,5,400,1,0,2,6,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,690,5,0,0,8,-1,-1,0,0,, ,0,,1,0
                0,2,4,990,4,0,4,4,-1,-1,0,0,, ,0,,2,0
                0,3,1,990,3,0,4,4,-1,-1,0,0,, ,0,,3,0
                0,4,3,1010,2,0,8,0,-1,-1,0,0,, ,0,,4,0
                0,5,5,990,1,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,-980,5,0,2,6,-1,-1,0,0,, ,0,,1,0
                0,2,4,-980,4,0,2,6,-1,-1,0,0,, ,0,,2,0
                0,3,1,100,3,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,3,-980,2,0,2,6,-1,-1,0,0,, ,0,,4,0
                0,5,5,100,1,0,7,1,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,420,5,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,4,420,4,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,1,420,3,0,5,3,-1,-1,0,0,, ,0,,3,0
                0,4,3,-50,2,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,5,420,1,0,5,3,-1,-1,0,0,, ,0,,5,0 Split Boards - Count and
                Line numbers,0 Section Pairs Count 2,0 Section Count, 2 x
                spares,0,0,0 Sessions Input,0 VP Type,W EBU Green or SBU
                National Points,0 Swiss Pairing,1,2,1,99 Swiss BPM, DualTables,
                Sections, Alloc LPP, SBU Bonus MP Top,7,-1,A,B,10,0 SBU MPs Per
                Match,0 BWS DB File Path, Quali-final is a Final,0 EBU National
                Pairs Heat,0 Deal File
                Path,C:/BridgeData/Test/DealFiles/2011Sep19!!.dup Swiss Pairs
                Match Being Scored,1 Swiss Pair Numbering,0 Swiss Pair Input
                From TS,0 UK MP Multiplier,1 Last Bm Db Line Read,0 Ecats Hand
                Records Needed, Session No,#FALSE#, Tables For MPs,0 Scorers
                Name, Directors Name,xxxx xxxxx,Mr Director Is Parallel Play,0
                Barometer Event,0 MPs Ignore Minimum Boards Rule,0 Reuse Board
                Count,0 Swiss Pairs Rounds,8 PP Event FileName, QualiFinal
                ScaleQF,0 EBU P2P Charge Rate#ERROR 448#
            </tns:datFile>
        </tns:xTournamentResultDatFile>
    </soap12:Body>
</soap12:Envelope>

1 个答案:

答案 0 :(得分:1)

web.config中有一个控制最大传输大小的部分:

<security>
  <requestFiltering>
   <requestLimits maxAllowedContentLength=”2000000000″ />
  </requestFiltering>
 </security>

但我怀疑这是你真正的问题。您是否尝试在Fiddler中检查请求以确保您的网页确实发送了正确的数据? 400错误可能意味着任何数量的事情,包括发布到一个畸形的URL(即https而不是http,错误的主机头等)。

<强>注释

虽然我在这,但为什么你这样使用XML信封?如果您要经历使用XML / SOAP的麻烦,为什么不传递更好的,XML友好的数据集(带子节点等)?

相关问题