What if we don't host our silverlight Application when we first Create it? - silverlight

As we all know very well..
whenever we create application inside silverlight it is asking us for hosting it
by dialogue box at given below.
My question is what if i unchecked the check box[Host the silverlight application in a new web site].
Means what kind of problem we have to face later if I don't host our Silverlight Application in any of the option given by dialogue box.

Basically it is not a problem at all. You can add a website at any time later.
In the project settings of a website there is a Silverlight tab. Under that you will find the option to add Silverlight projects to the website. This will setup the links to generate the XAP in ClientBin as well as giving you the option to create test pages for each Silverlight app added. The test pages will give you the sample JS you need to host your Xap later.

You will have to eventually host your application somewhere otherwise it will stay on your local harddrive and hardly reach any clients. So if you have an existing web site you could simply copy-paste the necessary javascript to this site later in order to embed your Silverlight application. In this case you can uncheck this checkbox.

Related

Problems with making Silverlight project out of browser

I have a task to make large Silverlight project run out of browser.
Fortunatelly I don't have to rewrite it to some other technology. Unfortunatelly I can not understand how to make it work OOB. I tried everything that's in guides :
enabling OOB option, installing and tryiung to debug installed app, but main thing is that when I run this app OOB I can't reach any services (no matter how I try HTML Bridge is disabled in OOB).
Is there a way to reach those services (like https://localhost/WCFRest/GetUserInfo?login=somelogin&password=somepassword) from OOB enviroment?
What should I do to reach them?
I'm sorry if this is noob quetion but I can't ask anyone else.
I assume you have a Web project in your solution. I think you changed the startup project to the silverlight project. You need to start up the Web project too.
Do the following:
Right click on the solution in the Solution Explorer and select Properties.
Select "Multiple startup projects" and set the action to "Start" (on the web project)
Or just simply right click on a HTML or ASPX file in the web project and select "View in Browser".

How to use a Silverlight Solution

I have a Silverlight app made in Visual Studio 2010 and I want to put it on a website but I don't have the slightest clue how.
I've looked at all the msdn documentation and they all mention a .xap file that is the file you use on the website but there is no .xap and I can't find out how to compile my code into a .xap file.
Also, when I run the App and look at the source in the browser, it has my code compiled into the .xap file, but there is no .xap file!
So my question is simply how do you go about getting a Silverlight app on a website because I've been trying for hours and I can't figure it out.
A sample html or aspx page is included when you create the solution. This is the page that the browser navigates to when you hit F5. You can take that page as a basic example of how to embed a Silverlight app in a page. You should find it in the project folder.
Silverlight projects are commonly built into a XAP file when you hit "Build" in VS. This file lives in the bin/Release or bin/Debug folder and basically contains your whole application.
Steps to create a silverlight application Hosted in a web site,
Select Silverlight Application Template while adding new project in VS2010
When you click Ok, ensure that Host the Silverlight application in a new web site is Checked.(It will create a new ASP.Net web application to host the Silverlight)
If you haven't checked the Host the Silverlight application in a new web site option, you can add a new ASP.Net Web application project and then go to its properties and select Silverlight Applications option in left pane. Then Click Add, select your Silverlight Application to be hosted and click ok. You are done now.
But If haven't selected the Silverlight Application Template, then you might have created a Silverlight Class Library. It wont generate any xap file. It just gives a dll. So you need to recreate a project as mentioned above.
I believe that in Silverlight whenever you create a project, right at the beginning, it will ask you if you want to create a web app automatically. If you chose yes, something like YOUR_PROJECT_NAME.web will be created, go into that folder, you will find a folder called ClientBin.
The .xap file will be inside that folder.
HTH

Loading Images for Silverlight app from server without ssl

I have an Silverlight application that uses ssl to communicate with the site-of-origin. The application loads a number of images from a separate server (running apache under port 81 without ssl). The images are regular png's. The images from the Apache machine are not loaded properly, i.e. the image control remains blank. When I post the same image on my app server (i.e. site-of-origin), and modify the link accordingly, the images are displayed properly. This link on MSDN says that images are media are excluded from access-restriction policies.
Would appreciate any suggestions.
I hope you are deploying your Silverlight application to a web server and not running it using the Visual Studio development server. I had a similar problem with images when I was using the built in development web server. You can find about my experience here.
It might help if you subscribe to ImageFailed event and post the stacktrace.
You are running into cross-scheme access restrictions in silverlight, see table at the bottom of http://msdn.microsoft.com/en-us/library/cc189008(v=vs.95).aspx
One possible solution is to load image using WebClient and call SetSource on image element. That is what we do in our app. In fact we wraped it into custom image control that hides all annoying details.

Generate Default Silverlight Web Project After Project Already Created

When you're creating a new Silverlight project, it asks you if you want to host the applicaiton in a new website and if you do so it generates a web project for you that's already setup and good to go. If you chose no when initially creating your Silverlight project is there any way to automatically generate this project?
Yes you can do it automatically still, and it works in both VS2010 and VS2008.
Right click on the project file of your web app in the solution explorer, and select Properties. Go to the Silverlight Applications tab, click Add.
From this dialog you can either select an existing Silverlight app from your solution, or create a new one. Don't forget to tick the Add a test page that references the control checkbox.

TestPage.aspx in silverlight

I am a beginner in silverlight. I want to know what is TestPage.aspx and TestPage.html in silverlight. Actually i have google it but din't get enough information. Can any one give me answer??
TestPage.aspx and TestPage.html are the pages which will host your Silverlight content. As you might know, Silverlight is just a project (not a web application) and needs a page that can host it.
These pages are created by default and help you to test your XAML content during your development, which you can later remove from your project.
TestPage.html is dynamically generated by the Silverlight application as part of the Debug process. If you take a look at the Debug tab for the application properties you will see an option to Dynamically generate a test page. If this is selected then you TestPage.html is created in the /Bin/Debug folder of your Silverlight application.
A better solution is to create a web application in the same solution as your Silverlight application then in the properties for the web application go to the Silverlight Applications tab and add your existing Silverlight app to the web project. Also make sure that the Silverlight checkbox is ticked in the Debuggers section of the Web tab of your web application.

Resources