我正在尝试导航到一个页面,其URL的格式如下:localhost:xxxxx/User/{id}/VerifyEmail?secretKey = xxxxxxxxxxxxxxx
我在RouteConfig.cs文件中添加了一个新路由,所以我RouteConfig.cs看起来像这样:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "VerifyEmail",
url: "User/{id}/VerifyEmail",
defaults: new { controller = "User", action = "VerifyEmail" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index",
id = UrlParameter.Optional }
);
}
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,当我尝试导航到该URL时,我得到了这个页面:
<Error>
<Message>
No HTTP resource was found that matches the request URI 'http://localhost:52684/User/f2acc4d0-2e03-4d72-99b6-9b9b85bd661a/VerifyEmail?secretKey=e9bf3924-681c-4afc-a8b0-3fd58eba93fe'.
</Message>
<MessageDetail>
No type was found that matches the controller …Run Code Online (Sandbox Code Playgroud) asp.net-mvc asp.net-mvc-routing asp.net-mvc-4 asp.net-web-api asp.net-web-api-routing
我有一个我在Play中创建的大实体!Java中的框架,我想使用Morphia和MongoDB从数据库中仅检索特定字段.实体本身非常大并且包含许多字段,因此我希望通过从中检索一个字段来提高应用程序的性能.
我知道这是可能的,但我无法弄明白该怎么做...
以下是我班上的一些领域Shop:
public String imagePath;
public String profileImagePath;
public String Motto;
@Reference
public Category primeCategory;
public boolean isOnline;
Run Code Online (Sandbox Code Playgroud)
如您所见,该primeCategory字段是Category我想要检索的实体.我在Morphia的网站上看到了一些想要实现的东西:
Datastore ds = null;
Shop shop = ds.createQuery(Shop.class).retrievedFields(true, "primeCategory").get();
Run Code Online (Sandbox Code Playgroud)
我不确定我到底在做什么.
如果有人可以向我解释这是不是这样,我应该怎么做,并提供一个例子,那将是很棒的.
当我的应用程序开始启动时,我想知道它是否在上次运行时,是否已崩溃或是否已成功关闭.请注意应用程序应该检测它自己,不要使用外部应用程序来检查它.
我如何使用C#做到这一点?