我在输出窗口中收到以下错误:
D:\{solutionPath}\.nuget\nuget.targets(76,9): error :
D:\{solutionPath}\.nuget\nuget.targets(76,9): error : Unhandled Exception: OutOfMemoryException.
D:\{solutionPath}\.nuget\nuget.targets(76,9): error MSB3073: The command ""D:\{solutionPath}\.nuget\nuget.exe" install "D:\{pathToConfigLocation}\packages.config" -source "" -o "D:\{solutionPath}\packages"" exited with code -1.
Run Code Online (Sandbox Code Playgroud)
以上是NuGet.targets.
D:\{solutionPath}\.nuget\nuget.targets(76,9): error :
D:\{solutionPath}\.nuget\nuget.targets(76,9): error : Unhandled Exception: OutOfMemoryException.
D:\{solutionPath}\.nuget\nuget.targets(76,9): error MSB3073: The command ""D:\{solutionPath}\.nuget\nuget.exe" install "D:\{pathToConfigLocation}\packages.config" -source "{localPackageDir}" -o "D:\{solutionPath}\packages"" exited with code -1.
Run Code Online (Sandbox Code Playgroud)
我的包源是否在NuGet.targets中
当构建正在进行时,它创建了尽可能多的nuget.exe进程,因为它耗尽了所有内存,然后它失败并再次进行.
我已经接受了命令并通过cmd运行它.
"D:\{longPah}\.nuget\nuget.exe" install "D:\{longPah}\packages.config" -source "\\{longPah}\NuGetPackages" -o "D:\{longPah}\packages"
Run Code Online (Sandbox Code Playgroud)
这给了我以下错误:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembl
y 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or
one of …
Run Code Online (Sandbox Code Playgroud) 我要注入的动作过滤器就像这样开始
public class UserAuthorisation : AuthorizeAttribute
{
public IWcfClientProxy<IAppFrameworkServiceChannel>
FrameworkServiceProxy { get; set; }
Run Code Online (Sandbox Code Playgroud)
我已经像这样设置了我的容器:
container.Register<IWcfClientProxy<IAppFrameworkServiceChannel>>(
()=> new WcfClientProxy<IAppFrameworkServiceChannel>());
container.RegisterInitializer<UserAuthorisation>(handler =>
{
handler.FrameworkServiceProxy = container
.GetInstance<IWcfClientProxy<IAppFrameworkServiceChannel>>();
});
Run Code Online (Sandbox Code Playgroud)
当我运行它时,FrameworkServiceProxy
属性为null.
我读过这篇文章:Simple Injector:在基类中注入一个属性并按照答案.我还在本页简单注入器文档中阅读了示例.
我不是注入基类,也许这就是问题所在?
我正在添加更多信息,因为我认为它应该是根据史蒂文斯的回答所说的.
我正在使用NuGet包用于MVC 3.这将以下内容添加到应用程序中:
public static class SimpleInjectorInitializer
{
/// <summary>Initialize the container and register it as MVC3 Dependency Resolver.</summary>
public static void Initialize()
{
var container = new Container();
InitializeContainer(container);
container.RegisterMvcControllers(Assembly.GetExecutingAssembly());
container.RegisterMvcAttributeFilterProvider();
container.Verify();
DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
}
private static void InitializeContainer(Container container)
{ …
Run Code Online (Sandbox Code Playgroud) 我有几个与此文件相关的问题(MVC-ControllerTypeCache.xml).
1)谁能告诉我这个文件何时以及如何生成?
我知道它是由框架生成的,以减少调用控制器时所需的反射量.
我也知道MVC源中有一些内部类用于处理它,控制器工厂GetControllerType
使用它们.
2)有没有办法在应用程序中使用它?
例如,如果我想列出应用程序中的所有控制器,使用此文件意味着我不必通过反射自己找到它们.
还应该知道如何/何时更新它,因为该方法GetControllerType(requestContext, controllerName);
将根据它在此文件中找到的内容返回您的控制器类型.
知道何时更新以及是否可以依赖它可能会改变从驻留在自己的程序集中的插件/模块注册控制器的方式.
我主要是纯粹出于兴趣而问.
问题:
我构建时遇到以下错误:
"'.Controllers.ControllerBase'不包含带0个参数的构造函数"
我的基本控制器看起来像这样:
public abstract class ControllerBase : Controller
{
public CompanyChannel<IAuthorizationService> authorizationServiceClient;
public ControllerBase(CompanyChannel<IAuthorizationService> authService)
{
this.authorizationServiceClient = authService;
}
}
Run Code Online (Sandbox Code Playgroud)
一个使用Base的示例控制器..
public partial class SearchController : ControllerBase
{
protected CompanyChannel<IComplaintTaskService> complaintTaskServiceChannel;
protected IComplaintTaskService taskServiceClient;
protected ComplaintSearchViewModel searchViewModel;
#region " Constructor "
public SearchController(CompanyChannel<IComplaintTaskService> taskService, CompanyChannel<IAuthorizationService> authService, ComplaintSearchViewModel viewModel)
: base(authService)
{
searchViewModel = viewModel;
this.complaintTaskServiceChannel = taskService;
this.taskServiceClient = complaintTaskServiceChannel.Channel;
}
#endregion
public virtual ActionResult Index()
{
return View();
}
}
Run Code Online (Sandbox Code Playgroud)
这似乎是绊倒T4MVC.
我应该不将params传递给基础构造函数吗?
Sitecore是否使用HttpContext来保存对DB的不必要的调用?
特别是对于上下文项和数据库?
谢谢