• No results found

Copyright © ESRI. All rights reserved.

Publishing Silverlight applications

In our last section, we will publish a Silverlight application and discuss some considerations for deployment.

Copyright © ESRI. All rights reserved.

Requirements and considerations

ƒPublishing your application

ƒXAP files: downloaded by the browser

ƒTips

ƒWeb server

Allow MIME types of the following to your server:

ƒ Expression blend

ƒCross-domain access

Requires a clientaccesspolicy.xml file

ƒInstantiate the Silverlight plug-in as early as possible

Extension MIME Type

.xap application/x-silverlight-app

Once an application has been fully tested and is confirmed to be stable, the application is ready to be deployed. I will open Visual Studio and publish the application using our last

demonstration. In Visual Studio I select Build, Publish Silverlight Application. And for this example, we are going to publish it to the local Internet information server. I select the local IIS icon, I highlight the default Web site directory. In the upper right-hand corner, select Create New Web Application, and I will give it a name of LTS_demo. I click Open, and I will select Publish.

This will publish all the files I need to run my Silverlight application on a Web server. I can also publish an application in Solution Explorer, as well. If I open my browser and type the address, it will launch my application that I'm running on my local Web server. Silverlight applications

in Windows Server 2008, already includes all the relevant mine types for both WPF and Silverlight including both ZAP and XAML extensions. So if you are using Windows Server 2008, you're all set. The same applies to a clean install of Windows Vista SP1.

An alternative to using Visual Studio to create XAML is to design XAML using Expression Blend. A Silverlight application creating Visual Studio can be easily opened in Expression Blend by right-clicking on the main page XAML file in Studio Solution Explorer and by

selecting Open in Expression Blend from the Context menu. Silverlight applications not hosted on the same server or domain as the data services you are accessing will need a client access poly.xml file on the remote Web service root directory. In other words, if you deploy a Silverlight application and an ArcGIS Server on different servers or domains, you will need a client access policy.xml file.

Here is an example of the policy file used by ArcGIS Online. You could use this as a reference when creating your own client policy.xml file. Silverlight begins downloading components and running your application as soon as the Silverlight plug-in object is loaded. To improve the load times of your Web page, you can call the Silverlight plug-in as early as possible in your Web page logic. This could be whether it's in HTML or whether it's in ASP.NET.

Copyright © ESRI. All rights reserved.

Review and Q & A

¾ArcGIS API for Microsoft Silverlight/WPF

ƒLayers

ƒGraphics

ƒTasks

ƒToolkit

¾Silverlight platform, Visual Studio, and the ArcGIS API for Microsoft Silverlight/WPF provide complete development environment

¾Create Silverlight applications for free with the API

To sum up the seminar, the ArcGIS API for Microsoft Silverlight WPF consumes services from ArcGIS Server in the form of map layers, graphics, and tasks. You can also use Bing Map services with the API. In addition, you can use the ESRI Toolkit to enhance your application's appearance and functionality. The Silverlight platform combined with Microsoft Visual Studio and the ArcGIS API for Microsoft Silverlight WPF provides a rich set of components and an IDE to create full-featured GIS applications. All of the applications you saw in our software demonstrations were created with samples from our ArcGIS API for Microsoft Silverlight WPF Resource Center.

As Nate mentioned earlier, we have posted the software samples in the code gallery of the Silverlight and WPF Resource Center. We encourage you to explore this Resource Center and

file on your server, Silverlight will check to see if a cross-domain XML is added. So if you use an HTP sniffer such as firebug or fiddler, you'll see that there's a first request for a client access policy, and if it doesn't find that, it'll look for a cross domain.

The advantage to using a client access policy is (1) if you have a client access policy, it'll save your application one request to the Web server, so it'll save on the chatter—only one response opposed to two, the second reason is that with a client access policy file, you have more control over what domains and subdomains have access to the application. Client access policy was built for Silverlight, so if you have the option, we would advise for you to put a client access policy on the server. But that's a great question.

I've got another question here from Sebastian in Quebec. And he says, how did you set the click event on the fire station graphics layer? Well, we might have gone too fast at that portion, and we apologize for that, Sebastian. What we did is, we first ran a query task to get all the features that satisfied our Where clause, and then that event returned a feature set of all the graphics and we went through, we did a for each loop, and for each graphic we added a mouse left button down and a mouse over and mouse out event handler. And when you click on that graphic, it goes to the event handler, passes in the graphic, that's where you get your x and y location, and then it takes the rest of the parameters and makes a request to the geoprocessing model. And if you want to take a little closer look at that, again all the samples are available for download on the Community Page of the Resource Center.

We've got another question here from Jenss in Norresundby. I apologize for my pronunciation.

Her question is, if I do a geoprocessing model on my server, I'm only getting 500 features returned every time. Is that an ESRI Silverlight issue on my server side? That actually is a setting with ArcGIS Server. With ArcGIS Server, the default is to only return 500 features.

There is a way where you can go in and manually change a file that has a parameter for how many features will be returned. The best place to look for an answer for that is to go to

support.esri.com and type in 500 features returned, and you'll get an entry that will describe how you can go about changing the number of features.

Another question from Lawrence in Calgary. In Silverlight app, when components are located in a Web server, what are in client workstations at run time? Well that's a good question. From what you saw in the demo we just did on the Web server, you have the Silverlight application, you have the Web page that the Silverlight player is in, as well as the ZAP, which contains all the files necessary to run the Silverlight application. When a client accesses that Web page, if you use an HTP sniffer, you'll see that the client actually downloads that ZAP file from the server and loads it into the Silverlight player. And again, if you download one of the samples, you'll see the Silverlight application and then the Web project that's used for deployment. And I think if you take a look at that, you'll see what files are included where.

Yeah, I think we have one more question, Nate, that we could take. Kamran from [Pakistan]

forgive me for butchering that. But asks, how can the Silverlight option be added in Visual Studio 2008? Well first, what you probably should do, what is probably the fastest, is to go to the Silverlight.net community, and under the Getting Started pages, it tells you all the

requirements to add the templates, and to add all the installation files that you need for the Silverlight Toolkit as well as for the Silverlight tools.

Copyright © ESRI. All rights reserved.

Related documents