gpt4 book ai didi

c# - Swagger 的错误。服务器在处理请求时遇到错误

转载 作者:太空宇宙 更新时间:2023-11-03 15:10:42 27 4
gpt4 key购买 nike

我在 swagger UI 中收到此错误。我在这个错误中存货将近 3 天。请帮我看看是什么问题。我用这个作为我的引用 https://github.com/abelsilva/swaggerwcf

Swagger UI Error response

    [OperationContract]
[WebInvoke(Method = "PUT",
UriTemplate = "UpdateJob/{UserName}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json)]
[SwaggerWcf.Attributes.SwaggerWcfPath("Update Job", "Update a job in Portal")]
PortalJob UpdateJob(
[SwaggerWcfParameter(true, "This is the Username assigned to a company to allow service processing")]
String UserName,
[SwaggerWcfParameter(true, "This is the populated job object")]
PortalJob job);

这是我的示例 json 条目:

{
"UserName": "Manila_user",
"JobID": 157,
"Site": "ATL",
"SiteID": 1,
"ClientName": "Manila Devs",
"ClientID": 14,
"ParentProductName": "Manila Parent Product",
"ProductID": 1519,
"JobStatus": "Received",
"JobStatusID": 1,
"UniqueID": 0,
"RecordAddedDate": "2016-12-12",
"ReceivedDate": "2016-12-12",
"ReleaseDate": "2016-12-12",
"RequiredMailDate": "2016-12-12",
"PrintedDate": "2016-12-12",
"MailedQuantity": 25,
"MailedDate": "2016-12-12",
"BillingQuantity": 0,
"InvoiceNumber": "11",
"InvoiceDate": "2016-12-12",
"RejectedQuantity": 0,
"RejectedReason": "test",
"ActiveRecord": 0,
"RecordLastChangedBy": "WCF",
"RecordLastChangedDate": "2016-12-12",
"SequenceNum": 0,
"StatusEventDate": "2016-12-12",
"StatusEventChangedBy": "WCF",
"Notes": "test",
"OnlineApproval": "2016-12-12",
"UserApproval": 0,
"FileID": 170,
"FileName": "test",
"ReceivedQuantity": 0,
"JobNumber": 0,
"GroupName": "Manila Group",
"Flex1": "string 1",
"Flex2": "string 2",
"Flex3": "string 3",
"TrackingID": 123,
"ImpressionCount": 0,
"GroupID": 5358
}

最佳答案

我在使用 SwaggerWCF 时也收到了这个错误。通过启用 tracing,我能够确定问题是对 Newtonsoft.Json 的依赖。在我的申请上。这是我发现的错误。

System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我通过 NuGet 重新安装了 Newtonsoft,这解决了我的问题。

关于c# - Swagger 的错误。服务器在处理请求时遇到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41267019/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com