如何在 Expression Blend 中为 MVC 项目设置启动页面?

发布于 2024-12-11 19:04:09 字数 263 浏览 0 评论 0原文

我们在 ASP.NET MVC 视图中托管 Silverlight 应用程序。我们没有可以选择作为启动的 aspx 或 html 页面 - 我们需要使用 URL 启动应用程序。

看来 Expression Blend 不允许这种启动配置 - 您必须选择特定页面。因此,您无法从 Expression Blend 启动/调试应用程序 - 它抱怨启动页面未设置。

是否有解决方案/解决方法允许我们从 Blend 启动 ASP.NET MVC 托管的 Silverlight 应用程序?

We are hosting a Silverlight application inside an ASP.NET MVC view. There isn't an aspx or an html page that we can choose as the startup - we need to launch the application using a URL.

It seems that Expression Blend doesn't allow this startup configuration - you must choose a specific page. As a result you can't start/debug the application from Expression Blend - it complains about startup page not being set.

Is there a solution/workaround that would allow us to start an ASP.NET MVC-hosted Silverlight application from Blend?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧故 2024-12-18 19:04:09

我一直在做的是创建一个 URL 路由(在 ASP MVC Global.asax.cs 中)来捕获 Silverlight 应用程序试图访问的任何页面。它应该点击控制器并返回显示 silverlight 应用程序的视图(假设路由设置正确),而不是返回 .aspx 页面或 404。

例如,

// route to catch Silverlight test page
routes.MapRoute(
      "SilverlightTestUrl",
      "Project.SilverlightTestPage.aspx", // whatever page it's trying to start
      new { controller = "Home", action = "Silverlight" }
);

// make sure the silverlight route is before the default 'catch all' route
routes.MapRoute(
      "Default", // Route name
      "{controller}/{action}/{id}", // URL with parameters
      new { controller = "Home", action = "Silverlight", id = UrlParameter.Optional } // Parameter defaults
);

编辑:虽然抱歉,但我想这无助于解决能够从 Expression Blend 运行项目的问题。我不是 Blend 的忠实粉丝,我不知道他们为什么不将 Blend 的一些功能合并到 Visual Studio 中。 Visual Studio 的 XAML 编辑器比 Blend 好得多。

What I have been doing, is to create a URL route (in your ASP MVC Global.asax.cs) that catches whatever page your Silverlight application is trying to hit. Instead of returning that .aspx page or a 404, it should hit the controller and return your view that displays the silverlight app (assuming the route is set up correctly).

For example,

// route to catch Silverlight test page
routes.MapRoute(
      "SilverlightTestUrl",
      "Project.SilverlightTestPage.aspx", // whatever page it's trying to start
      new { controller = "Home", action = "Silverlight" }
);

// make sure the silverlight route is before the default 'catch all' route
routes.MapRoute(
      "Default", // Route name
      "{controller}/{action}/{id}", // URL with parameters
      new { controller = "Home", action = "Silverlight", id = UrlParameter.Optional } // Parameter defaults
);

EDIT: although sorry, I guess this doesn't help the issue of being able to run the project from Expression Blend. I'm not a big fan of blend, I don't know why they didn't jsut incorporate some of the features from Blend into Visual Studio. Visual Studio's XAML editor is much better than blend.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文