我在swagger UI中收到此错误。我这个错误存在了将近3天。请帮我解决问题。我将此作为我的参考https://github.com/abelsilva/swaggerwcf
[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
}
答案 0 :(得分:0)
我也收到了SwaggerWCF的错误。通过在我的应用程序上启用tracing,我能够确定问题是对Newtonsoft.Json的依赖。这是我发现的错误。
System.IO.FileLoadException:无法加载文件或程序集“Newtonsoft.Json,Version = 8.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed”或其中一个依赖项。定位的程序集的清单定义与程序集引用不匹配。 (HRESULT异常:0x80131040)
我通过NuGet重新安装了Newtonsoft,这解决了我的问题。