如何通过反射从控制台应用程序获取Web应用程序组件信息(How to get web application assembly information from console application by reflection)
我需要获取控制器/操作方法名称的列表
的mvc网络应用程序
从控制台应用程序。
所以我用反射来做到这一点。
我将Web应用程序的.dll引用到控制台应用程序。
但是我无法从控制台应用程序源获取Web应用程序的程序集信息。var check = AppDomain.CurrentDomain.GetAssemblies(); var assembly = AppDomain.CurrentDomain.GetAssemblies() .First(x =>x.ManifestModule.Name == "RedStar.WebApp.dll");
抛出这个exceptipn'System.InvalidOperationException''序列不包含匹配的元素'
I need to get a list of controller/action method names
of mvc web application
from a console application.
So I use reflection to do this.
I referenced web application's .dll to console application.
But I can not get web application's assembly information from console application source.var check = AppDomain.CurrentDomain.GetAssemblies(); var assembly = AppDomain.CurrentDomain.GetAssemblies() .First(x =>x.ManifestModule.Name == "RedStar.WebApp.dll");
throws this exceptipn 'System.InvalidOperationException' 'Sequence contains no matching element'
原文:https://stackoverflow.com/questions/41159916
最满意答案
检查该jar是否存在于Classpath中。 这个jar应该放在Tomcat安装目录的lib文件夹中,或者它应该打包在web应用程序的lib文件夹中。
Check if the jar is present in the Classpath. Either that jar should be inside the lib folder of Tomcat installation directory or it should be packaged in the lib folder of the web app.
相关问答
更多-
除了IIS和Apache,还有没有其它的服务器程序[2022-05-09]
tomcat -
检查该jar是否存在于Classpath中。 这个jar应该放在Tomcat安装目录的lib文件夹中,或者它应该打包在web应用程序的lib文件夹中。 Check if the jar is present in the Classpath. Either that jar should be inside the lib folder of Tomcat installation directory or it should be packaged in the lib folder of the web ...
-
最后,我设法让它发挥作用。 这是如何: MyApplication.java package com.somecompany; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MyApplication { public static ...
-
我发现了这个问题。 我猜想问题出现在DB中。 在Vaadin应用程序中配置我的数据库连接包括一个context.xml文件,该文件与配置的DB连接,而且只是Tomcat的context.xml。 我所做的是我从这个context.xml获取连接配置并将其直接粘贴到Liferay的Tomcat中的context.xml中,一切正常。 这就是为什么这个Vaadin应用程序在部署在独立的Tomcat服务器上时起作用的原因,因为它在Tomcat本身覆盖了context.xml,而在Liferay上完成时并非如此。 ...
-
问题是我在Vaadin的观点/页面的名称。 在我的电脑上,有了Spring,我为每个视图命名,并且没问题。 但在Tomcat上,他想要一个没有任何名字的页面,换句话说,就是页面名称“”。 我将登录页面从“登录”更改为“”; 然后全部运行完美。 有用 ! The problem is the names of my views/pages in Vaadin. On my computer, with Spring, I have a name for each view, and it is ok. But ...
-
我认为您需要从USER对象中删除静态final。 任何静态final都只能为整个应用程序创建一次。 您需要它作为实例变量。 例如 private User USER = null; 并不是 private static final User USER = null; I think you need to remove the static final from your USER object. Anything static final can only be created once ever f ...
-
正如Sascha Frinken所建议的那样,解决方案是: VaadinService.getCurrentRequest().getWrappedSession().setAttribute("userName", "test-user"); As suggested by Sascha Frinken, the solution is: VaadinService.getCurrentRequest().getWrappedSession().setAttribute("userName", "tes ...
-
当我尝试在openshift中部署Vaadin应用程序时,我遇到了类似的问题。 如果你的生产模式等于false,则openshift没有将scss编译为css并不重要。 使主题工作的唯一方法是预编译scss然后部署。 为此,您可以使用Eclipse插件或通过命令行执行此操作。 您可以在此处找到有关它的更多信息: https : //vaadin.com/book/es/-/page/themes.sass.html I experienced a similar problem when I tried t ...
-
它抱怨它无法找到已编译的widgetset。 Vaadin在客户端使用GWT。 GWT使用Java编写客户端代码成为可能,但浏览器不了解Java,因此必须将GWT Java代码编译为Javascript,以便浏览器能够执行它。 要编译项目的widgetset,可以在项目的根目录中说mvn clean install 。 如果您不使用包含客户端GWT代码的任何插件,也没有在项目中拥有自己的GWT代码,那么您可以使用标准的预编译com.vaadin.DefaultWidgetSet 。 默认widgetset是 ...
-
在没有Vaadin图表的情况下在Vaadin应用程序中创建图表?(Create charts in Vaadin application without Vaadin Charts?)[2024-01-18]
我找到了dCharts小部件,但我不知道如何使用。 我在这里问: 如何在Vaadin项目中使用dCharts Widget? I have found dCharts widget, but I have no idea how to use. I asked here: How use dCharts Widget in a Vaadin project?