0

I have a new .Net webapi app that works fine on my development box but I can't get it running on our IIS8 server. The webapi can return data in XML format through a browser or through the application, but when I switch to MediaTypeWithQualityHeaderValue("application/json") then I just get the 500 Internal server error response from IIS.

So far in IIS 8 I have: Added a .json Mime Type (application/json) Installed classic ASP (seemded to need this for the next step) Added a .json Handler Mapping (.json / C:\WINDOWS\system32\inetsrv\asp.dll / JSON)

If anyone can give me any clues as to what I've missed that would be great.

Thanks

ac66
  • 49
  • 1
  • 7
  • At the moment I'ave had to switch to XML, but that wasn't straightforward because I got the error Expecting element 'SqlReferenceData' from namespace 'http://schemas.datacontract.org/2004/07/arbEvolveModel.webApi'.. Encountered 'Element' with name 'SqlReferenceData', namespace 'http://schemas.datacontract.org/2004/07/arbEvolveWebAPI.webApi'. – ac66 Aug 30 '15 at 08:01

2 Answers2

0

At the moment I've had to switch to XML because time was against me. But that wasn't straightforward because I got the error
Expecting element 'SqlReferenceData' from namespace 'http://schemas.datacontract.org/2004/07/arbEvolveModel.webApi'.. Encountered 'Element' with name 'SqlReferenceData', namespace 'http://schemas.datacontract.org/2004/07/arbEvolveWebAPI.webApi'. To get around this I had to add a ContractNamespace into both the web api project and the client app. Both references were slightly different as they had to convert their own namespace to a generic namespace. So for reference I had to use and . Thanks to XML deserializing only works with namespace in xml for the guidance here. Hope this helps someone.

Community
  • 1
  • 1
ac66
  • 49
  • 1
  • 7
0

I finally resolved this by running the client (it's a VB WPF client) on the server. By doing this I could see the full error message which told me the server was missing a DLL - not sure why this hadn't come up on the XML downloads. Once the error was fixed then the steps above had allowed JSON to work. Hooray!

ac66
  • 49
  • 1
  • 7