Question:
Are there known issues making calls to a service that calls another service from Silverlight?
Scenario:
I have the following 3 projects:
SilverlightClient - Silverlight project with a Button
SilverlightClient.Web - A web application that hosts the SilverlightClient.xap.
BackEnd - A different web application that hosts the FOO Service which does some special backend processing.
I have created a Silverlight WCF-Enabled web service in both SilverlightClient.Web and Backend. These are respectively SilverlightClientService and BackEndService.
From SilverlightClient.Web I add a service reference to BackEndService. I have a test ASPX page that I've written code that calls BackEndService successfully.
From SilverlightClient I add a service reference to SilverlightClient.Web's SilverlightClientService. If my SilverlightClientService returns plain data, such as a string, it works quite well.
The moment, however, that I change SilverlightClientService to call BackEndService, I get the following exception:
HTTP 415 - "The request failed with HTTP status 415: Unsupported Media Type."
I had an issue with 2 services not communicating. We finally figured out that using Cassini (the built in Visual Studio IIS) to host the ListenerService 'BackEnd' was causing the problem. Switching the project to start in a virtual directory of IIS allowed the two to communicate.
I was seeing : An error occurred while receiving the HTTP response to http://localhost:1484/MainListenerService.cs. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. and this error:
The HTTP request was forbidden with client authentication scheme 'Anonymous'.
Are you using basicHttpBinding? Silverlight only supports basicHttpBinding but the default when you create a WCF service is wsHttpBinding. You should change that on your web.config before adding the reference on your Silverlight project. Check out this video from Tim Heuer: http://silverlight.net/learn/videos/all/how-to-consume-wcf-and-aspnet-web-services-in-silverlight/
Related
I have a SOAP WCF service hosted in IIS and it is consumed by another company SAP system and everything was working fine for couple of years until our security team implemented Header validation in request and it stopped working all of sudden since the client SAP system request doesn't contain header CallingType. So then they added CallingType and pushed request to our system and F5 server allowed access and request entered to our system where WCF hosted. But WCF did not logged request and no data we got. So i would like to know how i can troubleshoot and provide fix. My network team is telling request is validated and passed by F5 server and pushed to our server. But why WCF is not logging anything??Do i need to add any custom header in webconfig of WCF service, or our IIS is preventing something? How can i see IIS is blocking the request.
There is an issue for connecting to my WCF service from dotnet core 3.1 . For adding service reference I'm using Add Connected Service and then enters WCF URI http://10.10.10.10:8330/mywcfservice. If I enter the remote address as I said before it works fine and server asks for authenticate my request. but after I entered my credentials, in status box it said:
An error occurred while attempting to find services at '10.10.10.10/mywcfservice'. The remote server returned an error:(400) Bad Requst.
If I add / after WCF URI, in status box it said:
An error occurred while attempting to find services at '10.10.10.10/mywcfservice/'. The remote server returned an error:(401) Unauthorized.
I tested my WCF Service with WCF Storm and it works just fine. On the other hand I can connect to WCF Service from .Net Standard Project like a charm. So where is the problem?
Based on the information you provided, I cannot know what happened to your server. You can refer to this link to record the error that occurred on the server-side:
Trying to add a service reference results in Bad Request (400) in one project, otherwise runs fine
Another solution is to use dotnet-svcutil command:
Use a browser to access the WSDL file of the service, and then save it locally.
Then use the dotnet-svcutil command to generate the proxy class.
Finally, add the proxy class to the project.
To use the proxy class also need to add these two packages:
Call WCF service in core:
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress endpointAddress = new EndpointAddress("http://localhost:8000/GettingStarted/CalculatorService");
CalculatorClient calculatorClient = new CalculatorClient(binding,endpointAddress);
Another thing to note is that there are some WCF functions that are not supported in core. For details, please refer to the link below:
WCF service works in MVC client but not in .Net Core 3 client
Feel free to let me know if the problem persists.
I have a few questions about setting up and running a WCF service after done coding it.
I've created my service. I'm able to right-click it in VS and choose to run it in the browser and it comes up.
Now I want to test tie service by creating a new C# project and adding a service reference to my service (.svc).
When I try to add the service reference it can't find it (e.g. http://localhost:55129/Cars.svc).
So do I need to have my service project running in order to add it?
And would I need to set it up in IIS? Or are people mainly running it from within VS, running the WCF project itself?
Here is the error I get when trying to add that service endpoint:
There was an error downloading http://localhost:55129/Cars.svc/_vti_bin/ListData.svc/$metadata.
The request failed with HTTP status 400: Bad Request.
Metadata contains a reference that cannot be resolved: http://localhost:55129/Cars.svc.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:55129/Events.svc. The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..
If the service is defined in the current solution, try building the solution and adding the service reference again.
If you're using the development web service, it has to be running for you to generate client proxies.
Hosting in IIS is more convenient in this respect as it is always running even if you don't have your solution open.
I have created a ReST WCF Service in .NET 4.0. It's hosted in IIS (.svc). The .svc file is mapped correctly in IIS 7.5. When I try to consume the WCF Service in MVC 3, I get an error :
"The remote server returned an unexpected response: (405) Method Not Allowed."
I created a proxy by adding a service reference to my MVC project. Let me know if you have encountered this issue and have the solution.
Please help! I already spent 2 days on it.
Consuming a REST service should not involve adding a service reference as in the REST style the client and service are independent.
In order to consume a rest service please see this article.
Also 405 Method not allowed might be that you are trying to perform a GET operation on a method that is defined for POST or vice versa.
I have one worflow service named GetDataWorkflowService.xamlx that I want to use in Silverlight.
When I add a service reference to my application, it gives a message 'This Operation is not supported for the relative URI.' It still adds the reference, however.
When I use the referece:
Servicelient proxy=new ServiceClient();
proxy.GetDataCompleted += (o, a) => Debug.WriteLine("Result is " + a.Result);
proxy.GetDataAsync(123);
I get the following error:
An error occurred while trying to make a request to URI 'http://localhost:1234/GetDataWorkflowService.xamlx'. 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. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
I don't understand what's happening.
A few things:
What happens if you use the WCF Test Client to call GetData()? Do you get an error or does that work just fine. If you get an error here concentrate on the server parts.
What happens if you set a service reference from a console application and call your workflow service. Same error or does that work?
Is the workflow service hosted in the same web site as the Silverlight client? If not do you have the cross domain policy files setup correctly.
Assuming the WCF Test Client works. Open up fiddler and compare the request from your Silverlight client with that from the WCF Test Client. What is different?
Enable tracing on the server to see if there are any exceptions or warnings that might provide more insight to what is wrong.
Check your startup project to be sure you are starting a web project and not the Silverlight project. For more details see Troubleshooting Workflow Services / Silverlight on my blog