IIS6 cannot handle WCF json response - wcf

I wonder if you could help me with this. I have a .NET 3.5 WCF RESTful service that returns json. Service works fine on my local machine but when I deploy it on IIS6 I get this error: The server encountered an error processing the request. See server logs for more details.
The WebInvoke method is GET and when I try to access the service method in browser on the IIS6 machine I get a prompt that asks me to download a file (with the response of the GET request).
I'm really baffled by this as when I choose to download and open the file I see the json that is suppossed to be returned....Strange behavior by IIS.
Any clues on this?

The answer was rather trivial...
Because my wcf operation was returning a List of objects for some reason IIS insists in that case the BodyStyle to be WebMessageBodyStyle.Wrapped , unlike local development service where the response was returned correctly both with Bare and Wrapped formats.
Thanks for all suggestions guys.

Related

Jitterbit web service request failure

I'm using Jitterbit to call a web service and output the response to a txt file. My web service call is failing with an authentication error. I understand the error but don't understand why I'm getting it. The credentials are correctly configured in the web service method. So, my question is, is there a way to output the web service request to the operation log so that I can see what values are truly being passed?
Thanks, Jason
I would suggest using global variables for your credentials and using the built in function...
WriteToOperationLog($variableName)

How to access WebService method from URL (target namespace in wsdl)? Call webservice from a MSSQL without CLR

Could you tell me how to access a web service method from a web browser? I need it to call a webservice from a database using only TSQL
I have a simple web service running on my local JBoss server.
I have found an information that a wsdl file is easily accessed by calling an URL:
http://localhost:8081/webserviceName?wsdl
I would like to invoke a method "simpleMethod". As I learned from reading tutorials I should call:
http://localhost:8081/webserviceName/simpleMethod
but it simply does not work. I have received an error that the requested resource is not available.
In received wsdl file there is a statement:
<wsdl:definitions name="DataServiceImplService" targetNamespace="http://services.test.com/">
Does it make any difference? Should I use that information to call a Web Service?
The main idea behind my question was to find a way to call a webservice from a database (and that is why I needed web service URL).
So I have found a web that explains how to do it entirely in SQL:
http://www.vishalseth.com/post/2009/12/22/Call-a-webservice-from-TSQL-%28Stored-Procedure%29-using-MSXML.aspx

WCF webHttpBinding Service Works Locally But Produces "400 Bad Request" on IIS 7.5

I have a WCF service with webHttpBinding binding that works fine in Visual Studio 2010 / local IIS. The service has only one POST method that my separate web app project invokes via .NET's HttpWebRequest object. JSON is used for request and response. Request and response contain objects translated into and from JSON by DataContractJsonSerializer.
Once I deploy the service to a different Windows Server 2008 R2 machine on the same network, it generates "400 Bad Request" in response to the exact same calling code that works fine locally. By "calling code" I mean my web app running in Visual Studio.
No problems viewing the .svc file via a browser.
The request is less than one kB so it doesn't seem like size is an issue. Just in case I also tweaked the service's Web.config to allow for larger requests but that hasn't helped.
Resolved this shortly after posting question. Should clear things up.
My Cisco RV220W got confused. It wouldn't route the request properly, but the nature of what exactly it was doing and why the behavior was intermittent is beyond me. Rebooting it solved my problem.

Why do I get a 403 error when calling a WCF Webservice?

I'm really posting this question so that others searching for the answer can find it.
Scenario:
WCF Service: Has worked fine at some point but currently is returning 403 errors. The web.config looks fine as far as I can tell. This machine has set the web.config to disable transport and message security and is using BasicHTTPBinding.
When I call it with my client generated from the Service Reference in Visual Studio, I get a 403 error. The error indicates there is some problem with the authentication, but as far as I can tell there is no such problem.
To solve this problem, I used Fiddler to get the actual error code - in this case, a 403.1. This indicated that the executable for the service couldn't be run.
The actual problem ended up being that the ASP.NET version was set to 1.1, not 2.0+. So setting that to 2.0 resolved the 403 permission error.
Http 403 error is "Forbidden". There is something that is blocking access.
In cases where it worked at one point and then stopped, it is often a windows update that has tightend up the security.
Where is your WCF service installed?
What are the ACL's on these files?
What is the security context of your service? (Which account will be used to access the files)
Does that user have access to the files?

Self hosted cross domain WCF service called from silverlight hosted in sharepoint

as the title already states I am trying to call a self hosted WCF service (hosted in a windows service) from a silverlight 4.0 application which is hosted in sharepoint 2010. I use the basicHttpBinding and I already tried a lot of things as suggested here:
http://www.dotnetfunda.com/articles/article416.aspx
or here
http://blogs.msdn.com/b/carlosfigueira/archive/2008/03/07/enabling-cross-domain-calls-for-silverlight-apps-on-self-hosted-web-services.aspx
but none of them worked I still get the error:
An error occurred while trying to make a request to URI 'serviceuri'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details.
The inner exception states:
when deploying an Office solution, check to make sure you have fullfilled all security requirements.
The two files clientaccesspolicy.xml and crossdomain.xml are accessible on http://myserver/clientaccesspolicy.xml and http://myserver/crossdomain.xml
Does anybody have an idea on how to solve this?
All these things helped me out. But the biggest thing for me was turning on Fiddler and tracing the request/responses from Sharepoint + Silverlight. I was getting a 502 error back for some reason. I noticed that my Url in my code was "http://localhost:", however the request from silverlight was "http://[servername]:" you would think that this should work, however it didn't.
I remembered I had run into issues before where "localhost" was giving me problems, thus what I did was to edit my Host file from /windows/system32/drivers/etc and simply add the line::
127.0.0.1 [servername]
I did a iisreset, I left fiddler running and I unchecked the Enable IPv6 option (Tools->Fiddler Options) and everything started working. The Clientaccesspolicy.xml could be accessed, and sharepoint + silverlight could call out into the wcf world :)!!!
There was one major issues however, when you turn Fiddler off, it stopped working... Now I have to figure this one out...
I hope this hellps you.