1

私は機能する webmethod を持っており、いくつかのオプションのパラメーターを追加しました (これらの値を提供することですべての呼び出し元に負担をかけたくないためです。私の webmethod は診断 EventLog.WriteEntry を構築するため、これらは主に私の開発ニーズのためのものです):

[WebMethod(Description = "DownloadFile method for ASP.Net clients")]
    public void DownloadFileCF(string trimURL, string TrimRecordNumber
        , string CallerPC = "not specified"
        , string RequestorID = "not specified")

次のような RESTful URI を使用して上記のメソッドを呼び出すこともできます: http://localhost/sdkTrimFileServiceASMX/FileService.asmx/DownloadFileCF?trimURL=60~GROUPER~1137&TrimRecordNumber=5

しかし、私はこれを取得します:

System.InvalidOperationException: Missing parameter: CallerPC.
   at System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
   at System.Web.Services.Protocols.UrlParameterReader.Read(HttpRequest request)
   at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
   at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

しかし、localhost で Web サービスの Web メソッドをテストし、最初の 2 つのテキスト ボックスのみに値を指定して [INVOKE] ボタンをクリックすると、引数はオプションとして扱われます。

私は REST ルールに非常に慣れていません。誰かがこれについて私をまっすぐにすることができますか?

4

0 に答える 0