如何将Silverlight托管从“测试页面”更改为“Web项目”?

时间:2022-08-26 23:19:11

I have a project with two silverlight apps (foo1 and foo2) and an ASP.NET web service (foo.web). When I created foo1, I configured it to be hosted in my web app by selecting "Link this Silverlight control into an existing web site" and then choosing foo.web as the site. However when I created foo2, I chose "Automatically generate a test page to host Silverlight at build time instead".

我有一个带有两个silverlight应用程序(foo1和foo2)和一个ASP.NET Web服务(foo.web)的项目。当我创建foo1时,我将其配置为托管在我的Web应用程序中,选择“将此Silverlight控件链接到现有网站”,然后选择foo.web作为站点。然而,当我创建foo2时,我选择“自动生成测试页面以在构建时托管Silverlight”。

I originally did this because I was not using the ASP.NET functionality for anything except hosting the page, and I thought I could save some mess. However after doing a bit of development, I learn that I will get a security error if I try to use a WebClient when my application is hosted on a plain HTML page. So it turns out I must host it through the ASP.NET application after all.

我最初这样做是因为除了托管页面之外我没有使用ASP.NET功能,我想我可以节省一些麻烦。但是在做了一些开发之后,我了解到当我的应用程序托管在纯HTML页面上时,如果我尝试使用WebClient,我将收到安全性错误。所以事实证明我必须通过ASP.NET应用程序来托管它。

When I look at the projects' property pages, I don't see any difference that corresponds to my hosting choice. I thought it would be under the "Silverlight" or "Debug" tabs, but those look the same in both projects.

当我查看项目的属性页面时,我看不出与我的托管选择相对应的任何差异。我认为它将在“Silverlight”或“Debug”选项卡下,但在两个项目中看起来都是一样的。

What do need to change in project foo2 so that it will be hosted by an ASP.NET page in the web application (foo.web) instead of being hosted on a generated HTML page?

在项目foo2中需要更改什么,以便它将由Web应用程序(foo.web)中的ASP.NET页面托管,而不是托管在生成的HTML页面上?

1 个解决方案

#1


6  

The change is on the web project. Go to the Silverlight section and choose which Silverlight applications you'll be hosting in the web project. It will also generate test pages for you if you want.

更改是在Web项目上。转到Silverlight部分,选择您将在Web项目中托管的Silverlight应用程序。如果需要,它还会为您生成测试页。

#1


6  

The change is on the web project. Go to the Silverlight section and choose which Silverlight applications you'll be hosting in the web project. It will also generate test pages for you if you want.

更改是在Web项目上。转到Silverlight部分,选择您将在Web项目中托管的Silverlight应用程序。如果需要,它还会为您生成测试页。