WCF Service Hosted in Windows Service + Silverlight + Silverlight Application - wcf

In my project am using WCF Service hosted in Windows Service.
Am able to get service reference of my wcf service to my Silverlight Application, But when i call a method in wcf service am getting error as follows :
Protocol exception was Unhandled by User-Code :
The server at net.tcp://localhost:4502/WCFHost/ rejected the session-establishment request.
Please help me out

The problem is most likely a missing/incorrect client access policy. This article walks you through setting it up. Just ignore the IIS related stuff and make sure you have the policy correct.

Related

WCF in windows service hosting with silverlight application

I have written WCF and hosted in windows service now when accessing the services via basic http binding, it is showing "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." Please suggest solution step by step
Thanks to all for not replying but I got the solution. Please suggest if anything is not in order.
We have created WCF and hosted it in Windows Services as netTCP. Now, I created Silverlight Enabled WCF Services in Silverlight.Web Project and call netTcp service from here and Silverlight WCF enabled Services called in Silverlight Project and it is running fantastic. Before this I tried from Web Service but it is taking when large data calling from silverlight application.

Issue consuming ReST WCF in MVC3

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.

consuming WCF service in .net 2.0 windows application

I'm new in WCF service and I need to consume the WCF service from my client for my current .net 2.0 windows app. I successfully added the WCF service as web reference in my .net 2.0 application but when using the web method of the service it took long time to execute the method and in the end my application is not responding. Base on the request in fiddler, the request has been timed out. My client provides me a user name and password but I don't know where to use it. Base on the wcf web service wsdl of my client, it uses WSHttpBinding.
I also created a sample .net 4.0 windows application and added the service as reference but still cannot use the web method. I check also the request in fiddler and gives me a response error "The request for security token could not be satisfied because authentication failed.".
Please help. I need to consume the WCF service using my existing .net 2.0 application.
Thank you very much in advance!
If you want to consume your WCF service from .NET 2.0 via adding web reference you must use BasicHttpBinding - that is only backward compatible build-in binding (except custom defined binding) with ASMX based client.
Your exception in case of .NET 4.0 test complains about security token - WsHttpBinding uses Windows security by default. It is hard to diagnose the problem further because you didn't provide enough information.

Windows Phone 7 Application + WCF + SSL + Username Authentication

I have developed a test service with WCF, which I try to consume from a Windows Phone 7 Application, however when calling a method from the service I get a weird exception:
There was no endpoint listening at
https://server/Service.svc that could
accept the message. This is often
caused by an incorrect address or SOAP
action.
The WCF service uses a custom binding with UserNameOverTransport authentication and SSL. For the authorization I am using an implementation of the UserNamePasswordValidator. If I try to consume the service from a console or silverlight application (cross domain policy is enabled) - it works fine (authorization as well). And the most weird thing is that the ServiceReferences.ClientConfig file generated for the WP7 App is exactly the same as the config file generated for the silverlight application.
I have no idea what is wrong with my service...
First suggestion: don't assume it's your service at fault. The WM7 SDK is far from bug-free. I suggest writing a conventional WPF, WinForms or Console client to test your service to be sure it's not a WM7 problem.
By the date of this question, it seems to me you were testing this in the emulator and the emulator doesn't support HTTPS.

Silverlight WCF Service to Service calls

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/