SWAGGER Error. The server encountered an error processing the request

1k Views Asked by At

I'm getting this error in swagger UI. I'm stock in this error for almost 3 days. Please help me what is the problem. I'm using this as my references 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);

Here's my sample json entry:

{
  "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
}
1

There are 1 best solutions below

0
DaVinciCoder On

I received this error with SwaggerWCF as well. I was able to determine the problem was a dependency on Newtonsoft.Json by enabling tracing on my application. Here was the error I found.

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)

I reinstalled Newtonsoft through NuGet and that resolved my problem.