How to perform operations upon a WCF service creation? - silverlight

I have an integration test suite in silverlight that requires an http server and a socket server.
What I've been thinking to do is to control the suite from silverlight through a WCF RIA service.
I would like to know how to start those servers (They are already coded in c# and can be run seperately) whenever the WCF service starts?

IF the WCF service is hosted in IIS ASP.NET, you can use Application_Start in Global.asax to trigger starting the other services.
If you host the WCF service in a console app or Windows service, then of course that is where you would call the code to start up those external services.

Related

How to secure database access in mvc web application

I am developing a web application in ASP.NET MVC, iOS and Android app using Xamarin that would have a common SQL Server database. I would want to develop a common layer/object that will have functions and methods common to all applications. I am also concerned about database security. I would want understand is there any other way in which this can be achieved.
I planning this roadmap :
I will develop web service or WCF services and host on a server, applications will communicate with these services and services will communicate with DB server.
If I develop web service or WCF service and host on a server, I want to prevent direct access and attack.
Which is better for my applications, web service or wcf service?
Masters please guide me.

silverlight duplex communicates with self-hosted wcf services cross-domain problem

I have a silverlight4 application which needs to call and be called back the wcf services self-hosted in a local windows-form application.
I wanna use the net.tcp protocal to achieve the duplex communication but encounter cross-domain problem.
It's easy to find solutions of the cross-domain problem but most of them is for the IIS-hosted WCF services.How to solve the cross-domain problem of a net.tcp WCF Service which is self hosted in a local windows-form application?
The solution is listed at the blog post at Enabling cross-domain calls for SL apps on self-hosted TCP services. Basically, if you have IIS installed on the machine you simlpy drop the cross-domain file for TCP in the root. If not, you can use the same self-hosted WCF service to serve the cross-domain file at port 80.

Adding service reference for Silverlight Application with WCF services

Im totally new to WCF. Trying to create a Silverlight application with WCF services.
Im not sure what address to fill in for adding the service reference for the client side.
Also, what do I need to specify in the Web config file in the server side?
Thanks.
There are a few different kinds of WCF Services. WCF Services, WCF Data Services & WCF RIA Services. For a bit of background on these types/kinds check out this forum entry.
If you are using just WCF Services, here's an intro and a sample and another sample that should get you going. :-)
Here's a great overview from Shawn Wildermuth on creating a WCF Data service & consuming it in various ways.
WCF RIA Services are specifically built/optimized for Silverlight. If you are in control of the Service as well you might want to look into creating a RIA Service instead of just a WCF Data Service. Here's an intro to RIA Services.

Problem Publishing WCF Ria Application Over Citrix Access Gateway

We currently have a silverlight app, one that uses "vanilla" wcf services and one that uses WCF Ria Services.
We publish the application via a citrix access gateway (secure web proxy).
The SL app that accesses the WCF Service works fine, but the RIA one fails with a ton of "response invalid" errors.
If you browse to the service url of either service (using the citrix url), then you see the WCF Service description fine.
Does anyone have any idea of any special config needed to enable WCF RIA Service apps to work over a Citrix Access Gateway?
Can you change the endpoint of the WCF RIA client proxy? Because I suspect it is trying to go to http://your.website.com/yourApp/yourService.svc when it really needs to go to http://your.website.com/cvpn/BIG_HASH_HERE/yourApp/yourService.svc. I have had to jump through some hoops to explicitly support the Citrix Access Gateway in a Silverlight app that I am working on at the moment (will come back later and possibly elucidate further when I have reviewed the code).

why Silverlight 4 uses WCF RIA service for Entity Framework?

I want to use Entity framework in silverlight , But with out RIA service .
Is there any way ?
If WCF RIA is mandatory than why so ?
Silverlight is a client side runtime (Code is not executed on the server). And therefore you cannot use Entity Framework to call a DB directly from it. RIA Services essentially create a web service layer that Silverlight can talk to. On the client side proxy classes are created to interact with the service layer. RIA Data Services is designed to make it appear as if you are interrogating EF directly.
To use EF without RIA services you can create a basic service class and have all your business logic in it, and from within this service you can use Entity Framework. You would make calls to this service layer just like any other service.

Resources