Hosting legacy Silverlight application in an ASP.NET MVC3 web application - silverlight

I am trying to convert an existing silverlight application to use a MVC web application versus a regular asp.net web application.
I have taken a look at fiddler and it is not able to access the domain service methods as the service does not exist (this is because these files are autogenerated once they are called with ria services). But with MVC since it looks for the controller if files don't physically exist we are getting this error.
I have tried to ignore svc files by:
routes.IgnoreRoute("{allsvc}", new { allsvc = #"..svc(/.*)?" });
and also have tried;
http://xamlcoder.com/blog/2010/01/15/upgrading-to-wcf-ria-services-asp-net-mvc-2/
With no success. Has anyone been able to successfully do this, if so, how?
Thanks in advance.

Related

Moving angularJS site to Visual Studio?

So in my quest to learn front-end development (doing server side, WCF, etc for the past 4-5 years), I managed to create a simple little movie app just using javascript and html. When I created this app, I was using Sublime Text and since I'm a .NET developer, I'd like to move this site over to Visual Studio and actually wire it up to WebAPI or MVC and start talking to a database.
What is the best way to move over a pure html/javascript/css site into Visual Studio and wiring it up for db connectivity? I thought about just creating a web site project in a solution and start wiring it up to a BLL and DAL layer but I didn't know if that was ideal or not.
Any help would be appreciated.
Thanks!
IMO Your best bet is to create an empty WebAPi2 project in VS and create a folder called 'app' that you will move your Angular files into.
Right click your project and go to the Web tab. Set the start page to whatever HTML file is your main page.
You should now be able to just F5 and run the application. Then start creating WebApi controllers for your data layer and you should just able to hit the API from localhost/api (or whatever you designate in your routes)
AngularJS should be completely independent of the server language (php, c#) and server (nginx, apache, IIS) you run it on.
I have worked on angular projects that talk to C# WCF services and are hosted on IIS just fine. You best bet is to create restful services in WCF and use angular services and factories to pull that data into the client angular app.
I think the best place to start would be the $http service of Angularjs.
https://docs.angularjs.org/api/ng/service/$http

ServiceStack as a ServiceLayer for MVC, WPF, WP7-8

after bumping into ServiceStack i would like to explore the option to have ServiceStack as a ServiceLayer for my existing MVC4 Project. The goal is to create a servicelayer for all other platform options like wpf, windows phone...
My main issue is the existing mvc project and the need to continue to use the SimpleMembershipProvider. Is it possible to move all code of the default AccountController to the ServiceStack ServiceLayer and call it from the AccountControler (WebSecurity Class)? Has someone tried something like this or should i dump this code and start a ServiceStack specific Security Class?
Regards,
S. Mantziaris
The first part on service layer is in http://nuget.org/packages/ServiceStack.Host.Mvc/ (adding it to your MVC4 project via NuGet almost instantly gives your a working service layer, just run and check yourhost.com/api/metadata).
https://github.com/ServiceStack/SocialBootstrapApi gives you a detailed example how to do authentication and authorization the ServiceStack way.
Check these two answers on how to integrate ASP Membeship and ServiceStack:
https://stackoverflow.com/a/8715958/801189 and https://stackoverflow.com/a/15078308/801189

"Calls to the web service will fail..." Once Again

Last year someone reported encountering this problem ("The Silverlight project you are about to debug uses web services. Calls to the web service will fail unless the silverlight project is hosted in and launched from the same web project that contains the web services.") and accepted the answer to "set the web project which hosts the Silverlight application to be your startup project."
I'm seeing the same message, but think the solution might have to be different. I am building in VS 2010 a Silverlight application to access the Google Weather API, with VB as the code-behind. The API will return a XML file with data for the specified city (ex., "http://www.google.com/ig/api?weather=london,england"). The Solution Explorer only shows my VB/Silverlight project ("GetWeather"), and the Project Properties dialog box shows the Startup Object as "GetWeather.App" -- the only choice. I'm trying to use a WebClient object to make the call and an XDocument object to parse the return. But I repeatedly get the above error message, with no other result. What am I doing wrong?
Thank you in advance!
I would add a simple Web project and configure it to host the Silverlight app. You'll need to host the app somewhere anyways, so why not create a stub ASP.NET application in your solution? The easiest way is to create a new Silverlight app solution selecting an ASP.NET web project as the host, and then copying your existing code to that solution. Then you should set the web project as the startup one. This should make debugging a lot easier.
Besides, do remember to configure the client access policy to enable cross-domain calls. Check out this article

Add web project to silverlight application - how to

I have created a WCF Service application, which contains a reference to a service I created.
I want to add this service application as the web component of my SL application, but I can't seem to find the option that allows me to do this.
Can someone help me out here?
Thanks.
I think you need to create a web site, then add a reference to the WCF Service from the website. You could also just have the .svc file in the website. Then right-click on your Silverlight application project and Add Service Reference. This will generate the Reference.cs (show all project files and expand the service reference to see) that will contain all the classes that you exposed in your WCF Service through return or paramaters in your methods.

Sharepoint with silverlight app

I am new to Sharepoint. I wrote a simple RIA MCF silverlight app which runs all the queries right on my server. Now I tried make it available on a Sharepoint testing site. I loaded the xap file but Sharepoint throws me tons of load operation exceptions when it tries to load the app, apparently having problems with the EDM in the app. What do I need to do here? Is the xap the only thing I need to load on the shared documents folder?
Thanks.
Justin,
There are few steps you need to follow to load the Silverlight XAP in sharepoint.
You need to create RIA service as an independently hostable web application (.svc)
Follow the guidelines available here
Once you have the solution ready. Host service on IIS and make sure that it is functioning correctly.
Configure the .svc in the web.config of the hosting web application and access the same in your silverlight application as below
new LoggingContext(new Uri(ConfigurationManager.AppSettings["LoggingServiceUrl"]);
Load the xap on sharepoint site and in the configuration section provide links to .svc services.

Resources