.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Post New Web Links

Can I use WinForms, ASP.NET and Silverlight with the same WCF service?

Posted By:      Posted Date: October 17, 2010    Points: 0   Category :WCF


I'm exploring WCF, trying to find my feet and decide if it's the right architecture for our project. We are looking at having a WCF service that provides a central point of access for various clients, including WinForms, ASP.NET and Silverlight 4. We are using self-tracking entities (STEs).

I have tested out a solution in which I can have a WCF service and use it from WinForms and ASP.NET without any problems. I used the STE T4 template, and put the STEs in their own class library, which I referenced from the client project. This all worked fine.

I ran into trouble trying to build a Silverlight 4 client to access the same WCF service. It seems that SL can't reference a non-SL project, so I can't use the same STE project as I used in the other client. I added a SL class library, hoping I could use that in the non-SL clients, but this didn't work.

So, it looks like I am going to have to have two separate WCF services, one that sends out plain old STEs, and one that uses a SL version if I want to get this to work. Frankly this is unacceptable, and one of the main points of having a single point of access was consistency. If we have to maintain two separate services, we lose a lot of that.

I have searched in vain for an answer to this, which surprises me as I would have expected many people to want to do such a thing.


View Complete Post

More Related Resource Links

Data Points: Service-Driven Apps With Silverlight 2 And WCF


Here John Papa demonstrates how to build a Silverlight 2 user interface that communicates through WCF to interact with business entities and a database.

John Papa

MSDN Magazine September 2008

consuming a web service in silverlight

Hi all,      I am new to silverlight. I have to develop an application where I have to consume a web service http://www.xignite.com/xRealTime.asmx?WSDL to display the real time stock price on a data grid in the silverlight application. Can anyone please tell me if it is possible and if the answer is yes how do I go about it.If the answer is no please tell me what is the best way to display these values using a silverlight application.     

Silverlight enabled web service security error

I tried to create a SL enabled Web Service by following the example from the Microsoft link: http://msdn.microsoft.com/en-us/library/cc197940(VS.95).aspx When I got to step 6 to test the web service that I created (View in Browser), I got the following error:  Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service. My IIS is located on my local machine with Windows Integrated Authentication and Anonymous access unchecked. After checking the Anonoymous access checkbo, I still got the above error. I have read other post on the Internet that Silverlight uses BasicHttpbinding but the settings in the web.config file was created by Visual Studio 2010 (running .NET 4.0), so I didn't think I need to mess with it. The following is the section from the web.config: <system.serviceModel>   <behaviors>    <serviceBehaviors>     <behavior name="">      <serviceMetadata httpGetEnabled="true" />      <serviceDebug includeExceptionDetailInFaults="false" />     </behavior>    </serviceBehaviors>   </behaviors>   <bindings>    <customBinding>     <binding name=

silverlight + WCF Service + Dynamic proxy(custom binding) + basic authentication on iis

hi all, I am having an issue with how to get windows identity in silverlight project. Below is my scenario: the silverlight application need to get data from server via WCF service, i used the way that built dynamic proxy at runtime and aslo used custombinding in this case. Now my application need to deploy on iis and chosen "basic authentication" as a authentication mode. Thus i have chosen authentication mode in WCF was " <security authenticationMode="UserNameOverTransport">". At the client side where kind of project is silverlight that i need have to dynamic proxy with custombinding. My question is: In basic authentication how can i get windows identity to set to chanelfactory.Credentials: _channelFactory = new ChannelFactory<TWebService>(this._binding, new EndpointAddress(_endpointAddress));            _channelFactory.Credentials.UserName = new UserNamePasswordClientCredential();            _channelFactory.Credentials.UserName.UserName = "username";            _channelFactory.Credentials.UserName.Password = "password"; actually, i do not want to use Windows a

WF Service and Silverlight Cross domain exception

Hi I have created a workflow service (xamlx) and hosted it on IIS. The web.config file of the service is: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <services> <service name="VacationRequestService"> <endpoint contract="IVacationEntry" binding="wsHttpBinding"/> </service> </services> <behaviors> <serviceBehaviors> <behavior> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests

Problem with Silverlight & WCF service



I've got a silverlight app which calls a WCF service deployed in SharePoint. The entire site is secured by https, so the WCF service is too. When I deploy the Silverlight app, it works ok from the front-end server itself. But when opened from a different machine outside the network, it throws an error: "The remote server returned an error: NotFound". I checked the WSDL, what I noticed is that the port address in the bottom section of the file lists the internal network address. So I tried explicitely hardcoding the correct (internet) address in the constructor of the WCF service object, but that doesn't seem to do anything.

I tried fiddler, but because the site is secured, that's not giving me any clues either. Where can I look next or what could be wrong!?

MCTS in Web Application Development in .NET 2.0

Best method for authentication with an external WCF service called from a Silverlight 4 Web Part ins

If we have a Silverlight 4 application which gets its data from an external WCF service and is deployed as a Web Part on in SharePoint 2010 what is the best method to perform authentication in the WCF service itself.  The service is not on the same domain as the SharePoint server but any user authenticated by the SharePoint server (and only those users) should be able to access the service.  Since the Silverlight application is calling the service the WCF service itself must be configured to use BasicHttpBinding which, of course, severely limits possible authentication methods.

Cannot read Silverlight client ip-address in service


I'm using the following code to read the ip address and port from a client that connects to my service:

            //Read IP-address and port
            MessageProperties messageProperties = OperationContext.Current.IncomingMessageProperties;
            RemoteEndpointMessageProperty endpointProperty = messageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            string ip = endpointProperty.Address;
            string port = endpointProperty.Port.ToString();

If I connect with a wpf client using netTcp binding I can read the proper ip adress and port number but if I connect with a SL4-client with the PollingDuplex the ip adress is empty and the port is 0. Why is that?

Thanks for help!

EDIT: I noticed that it works as supposed for Silverlight 3 so this seems to be SL4 specific.

WCF Service returning DataTable for silverlight client



I am creating a WCF 3.0 service which will fetch data from the database and return mostly in DataTable and DataSet format. I am building a Silverlight client for consuming this service. But what I found is Silverlight 3.0 does not support datatable or dataset. Unfortunately most of my datas are returned in the datatable format. Is there any way to consume datatable in silver light or converting datatable to generic list or LINQ before returning them? If it is possible to convert datatable to generic collection, does it possible without iteration? This is because converting hundreds of records by iterating will affect my performance.

Thanks in Advance!!!!

Best regards,
Subalakshmi Vijayarajan.

Subalakshmi Vijayarajan.

Return ReadOnlyCollection from WCF service and use it in Silverlight 3 client application

Hi all!

I have a solution containing of 3 parts: wcf service, wpf app and silverlight 3 app.
Both wpf app and silverlight app use wcf service to get a collection of objects.

The point is that my business requirements insistently tell me to return ReadOnlyCollection<T> from wcf service.
When I try to do it I have Serialization exception in silverlight client app. But it's ok in wpf app.

Then, I haven't started the investigation for such strange thing (different behavior in wpf and silverlight) and decided to implement custom serialization, returning the ICollection interface and trying to get ReadOnlyCollection on deserializing.  But wcf service proxy class in silverlight app returned Array of T, not ReadOnlyCollection<T> as proxy in wpf did.

So, the question is: Is it possible to return ReadOnlyCollection<T> from WCF service?

Any help is appreciate.


Free WinForms/ASP.NET/Silverlight controls

Some free set of controls of good usage

Silverlight application using RIA Service v1.0 give error in Sharepoint 2010


Hi All,

I am using RIA Service v1.0 in Silverlight 4.0 to retrieve database from sql-server and display on Silverlight application. For this I create RIA class library using Template available in VS2010.  In silverlight application I just fetch the employee from the Employee table and displaying in Silverlight Datagrid. Silverlight application is working fine with ASP.Net web. But when we going deploy same silverlight xap file to Sharepoint  Foundation Server 2010 using Module,deployed sucessfully,webpart display properly except following script error occurred in browser and data is not fetched.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.3; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Timestamp: Mon, 24 May 2010 13:46:40 UTC

Message: Unhandled Error in Silverlight Application Load operation failed for query 'GetEmployees'. The remote server returned an error: NotFound.   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)

Web Service different between Asp.net Application and SilverLight Application


Hi All,
I try to use this webService ws.eoddata.com/data.asmx in web application i can access all information using following code:

        var wsEOD = new com.eoddata.ws.Data();
            var response = wsEOD.Login("khem", "Nepal"); [Example]

            if (response != null)
                if (!string.IsNullOrEmpty(response.Token))
                    hddtoken.Value = response.Token;
                    // Load Exchange Dropdown

Is it possible to create a SharePoint web using Silverlight and the Sites.asmx service?


I'm in the midst of trying this out, but I'm running into one issue.

At the very end I get an error "Error in deserializing body of reply message for operation 'CreateWeb'." within the Reference.vb.

I'm not sure what's going on here, so any assistance would be very helpful.

Here's some sample code.

  Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button3.Click
    Dim client As New ServiceReference3.SitesSoapClient

    AddHandler client.GetSiteCompleted, AddressOf client_GetSiteCompleted

    AddHandler client.CreateWebCompleted, AddressOf client_CreateWebCompleted

    Dim lcid As System.UInt32 = Convert.To

Silverlight calling WCF service on IIS 5.1, deployed by VS2010



Hi everyone,

I just started to learn silverlight. I had no choice then to learn web deployment applications and WCF services.

So I created a Silverlight application calling a WCF services functions storing and retrieving informations on a Database.

So I installed IIS 5.1 on my XP Pro and I published the Web project using VS 2010. Everything is fine so far with some settings I made on IIS.

But when I run the aspx page the Silverlight code runs good except when it is time to call the WCF services functionnalities.

Nothing happen.

Calls to the WCF services don't work. I cannot figure out why.

It's been hours I search on the net but nothing helps.

Thanks for your help.

Ingredients for Perfect Web App Recipe , Silverlight 4.0 + WCF RIA Service+ Entity Framework

When Silverlight launched in 2006 , world saw it merely as a flash replacement but with Silverlight 4 things have changed a lot .Now Silverlight far ahead from its adobe competitor at least in terms of technology implementation and rich development environment .RIA enabled Business Apps with Silverlight is not just a illogical stich of technology concept but it is a well thought architectural paradigm shift ,In this post i am going to introduce RIA services in .Net framework 4.0 using Silverlight .

Debugging WCF service from silverlight app


I have WCF service and its hosted in IIS. ( NOT VS WebServer). My client app is silverlight. How do i step into the service when i'm testing it from silverlight app?

it just goes to System.IAsyncResult _result = base.BeginInvoke("GetCustomer", _args, callback, asyncState); and returns from there. How do i step into the service? I have pdb files inside bin folder of web app.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend