0

I have a C# web api that processes GET requests and returns json data extracted from third-party local database(it uses third-party library to interact with the db). Everything is working fine when I fire the web service from Visual Studio 2015.

I have published the web service to both local IIS and remote IIS. But the problem is that it does not return any data - it is returning 400-BAD REQUEST.

http://localhost:57984/api/staff

returns in IISEXpress(Visual Studio 2015)

{
"documentrequest": {
"@type": "staff",
"@mode_display": "employ_and_dismiss",
"@get_photo": "true",
"@subdiv": "",
"staff": {
"staffnode": [
{
"@last_name": "Андреев",
"@first_name": "Андрей",
"@middle_name": "Андреевич",
"@id_internal": "11100",
"@id_external": "" ......

but on local IIS and remote IIS it is returning:enter image description here

  1. What am I doing wrong?
  2. Why third party library(referenced in my project) not being published to IIS?

Hope to get some help! Thanks in advance.

khurshed_nosirov
  • 248
  • 4
  • 20
  • have you tried setting content-type as application/json in the request header? – Shahbaz Aug 22 '17 at 10:31
  • @Shahbaz response.Content = new StringContent(deps, Encoding.UTF8, "application/json"); this is what I am trying to return – khurshed_nosirov Aug 22 '17 at 10:39
  • Okay but are you setting that in your request header – Shahbaz Aug 22 '17 at 10:41
  • @Shahbaz thanks, surprisingly I was pushing Badrequest on my own in my code. Now I see the exception with text: Retrieving the COM class factory for component with CLSID {E74FA501-350F-43CF-8C15-D831778FD465} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). – khurshed_nosirov Aug 22 '17 at 10:44
  • Maybe it has something to do with the third-party library I am utilizing to connect to the database? it is not there in IIS..what should I do? – khurshed_nosirov Aug 22 '17 at 10:46
  • 3
    Try enabling 32 bit application in your application pool settings – Shahbaz Aug 22 '17 at 11:00
  • 1
    Your 3rd party dll might be a 32 bit library – Shahbaz Aug 22 '17 at 11:01
  • ... and confirm all your libraries are installed. If you don't know what this is, follow this guide on the machine where the code works: https://stackoverflow.com/questions/897743/how-to-find-a-dll-given-a-clsid – Nick.Mc Aug 22 '17 at 11:02
  • Enabled 32-bit applications in local IIS. Now it is working. Tried out the same on remote IIS, but now getting error: (104) Connection reset by peer. Do you have any idea? – khurshed_nosirov Aug 22 '17 at 11:17
  • I think your remote server is blocking your 3rd party dll's connection, just a guess. So **just for the try sake**.. can you turn off your firewall for a while and try if that starts working. – Shahbaz Aug 22 '17 at 11:27
  • Before that.. just restart your web site and try reloading a few times – Shahbaz Aug 22 '17 at 11:29
  • Turned off the firewall and antivirus, restarted also but no way. If I make a local request on the remote server localhost:8080/PercoWebService/api/staff the web service returns what I need. But it does not when I request over web by http://109.74.65.189/PercoWebService/api/staff – khurshed_nosirov Aug 22 '17 at 11:49

0 Answers0