mango
mango

Reputation: 21

WCF calls 3rd party DLL only works in VS2015 but not without

I am using 64bit Windows7 home premium SP1 and VS2015.

I wrote a WCF application which calls a 3rd party dll (from vendor) written in C#. When i "view in browser" by right clicking ProductREADService.svc in VS2015 solution explorer, I can call the svc(localhost:17476/ProductRESTService.svc) and method(this calls the 3rd party dll localhost:17476/ProductRESTService.svc/getproductlist/1) and the WCF works without any problem on the browser (chrome and IE), returning xml result correctly.

Now I want this WCF to running without VS2015 since I need it to run in production env.

Problem:

1) However, when I publish this WCF to IIS7.5, I was able to call the svc (localhost:8123/ProductRESTService.svc) without problem, but when I called the method (localhost:8123/ProductRESTService.svc/getproductlist/1) I encountered request error "The server encountered an error processing the request. See server logs for more details." When I checked the logs I found this: 2016-09-07 12:46:44 ::1 GET /favicon.ico - 8123 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/52.0.2743.116+Safari/537.36 404 0 2 3 2016-09-07 12:48:26 ::1 GET /ProductRESTService.svc/getproductlist/1 - 8123 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/52.0.2743.116+Safari/537.36 400 0 0 4

I tried changing the DefaultAppPool identity to LocalService and my windows login ID, nothing works.

In order to confirm the problem lies with the 3rd party DLL, I changed the method getproductlist not to load/call the 3rd party DLL but instead return fixed dummy value, and now both works perfectly. So I am sure the problem is caused by the DLL when running without VS2015.

2) I reverted back the code and stopped IIS and tried running IISExpress (using the IISexpress used by vs2015). I started it using the same config file as VS2015 inside /config:path-to-code.vs\config\applicationhost.config... I encountered the exactly same issue, while accessing localhost:17476/ProductRESTService.svc there is not problem.. BUT encountered error when accessing the method localhost:17476/ProductRESTService.svc/getproductlist/1.

Question:

q1) how come the WCF calling 3rd party DLL only works when launched using VS2015 and not when launched via IIS7.5 or IISexpress independently?

q2) how to copy the IISexpress settings/config from VS2015 into IIS7.5 and to the c:\program files\IIE Express\IISexpress.exe?

Any help will be appreciated. Thanks!

Update: 2) I found the problem for IISExpress.. I changed to "C:\Program Files (x86)\IIS Express\iisexpress.exe" instead of "C:\Program Files\" and both svc and method work! Why not "C:\Program Files" since my OS is 64bit?

I still cant get IIS to work for both, any help would be appreciated!

Thanks!

Upvotes: 1

Views: 204

Answers (1)

mango
mango

Reputation: 21

Update Solved!

I managed to fix the problem. In IIS 7.5.76 I set the DefaultAppPool advanced settings to

1) .NET Framework Version v4.0

2) Enable 32-bit application = true

3) Identity = LocalSystem

Now, my WCF service and method(calling 3rd party DLL) works with IIS and I can run it as a production service!

Upvotes: 1

Related Questions