我有一个问题实际上类似于Visual Studio调试/加载非常慢但我没有设法找到这样的问题的解决方案.
我已经尝试了该问题中描述的所有内容,但第一次加载的符号速度非常慢.
与其他问题类似,在启动MVC项目时,我在"输出"面板中获得了几行,其中包含类似于:
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\02ba097f\ab73cbf7\App_Web__headerusermenu.cshtml.ee708ea.myhgafpb.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\02ba097f\ab73cbf7\App_Web__layoutcmsbase.cshtml.ce72eb6d.ovoanhe-.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\02ba097f\ab73cbf7\App_Web__notificationmessage.cshtml.5346933.9aei7ems.dll', Symbols loaded.
Run Code Online (Sandbox Code Playgroud)
这些条目每个大约需要300到500毫秒,这些条目对我们在项目中的所有部分视图执行,这是相当可观的.
我在另一个问题中尝试了解决方案,但仍然没有得到任何快速的响应时间.
这些是我们做的一些测试:
这非常令人沮丧,因为为了第一次加载项目需要花费很长时间.
任何可能的解决方案除了Visual Studio调试/加载问题中提到的那些可能有帮助吗?
我想创建一个执行以下操作的函数:
.sprite-size (@width,@height,@x,@y) {
width:~'@{width}px';
height:~'@{height}px';
background: @sprites no-repeat -~'@{x}px' -~'@{y}px';
}
Run Code Online (Sandbox Code Playgroud)
我想通过一个正数值,@x并且@y然后在输出否定他们.上面的LESS函数输出以下示例:
//LESS
.header-language-selection {
.sprite-size(44,21,312,0);
}
//Outputs CSS
.header-language-selection {
width: 44px;
height: 21px;
background: url('/Content/images/sprites.png') no-repeat - 312px - 0px;
}
Run Code Online (Sandbox Code Playgroud)
如您所见,输出结果包含-和之间的空格px.有没有办法可以删除它并实现我想要的?
我希望该行的输出为: background: url('/Content/images/sprites.png') no-repeat -312px -0px;
在本地运行Asp.Net MVC应用程序时,一切运行正常,但是当在服务器上部署应用程序时,我收到此错误.
Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Run Code Online (Sandbox Code Playgroud)
我刚刚System.Web.Optimization通过NuGet 添加了框架,它使用了WebGrease.
如果我检查引用,我的WebGrease版本是1.5.2.14234,高于抱怨没有找到的版本 - 1.5.1.25624.
在根网站配置中,我在运行时标记下面有以下内容:
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
如果我检查服务器上bin文件夹中的WebGrease.dll,则WebGrease DLL的版本为1.5.2.14234.谁可能要求其他版本1.5.1.25624并且知道如何解决这个问题?
非常感谢!
我使用Rotativa ViewAsPdf方法将ASP.Net MVC中的HTML视图渲染为PDF .我通过设置以下设置输出为A4尺寸,纵向和无边距:
new ViewAsPdf(MVCCfpFormatter.Members.Views.FlightPlansFullPagePrint, model)
{
// FileName = flightPlan.ListingItemDetailsModel.FlightDetails + ".pdf",
PageSize = Size.A4,
PageOrientation = Orientation.Portrait,
PageMargins = new Margins(0, 0, 0, 0),
PageWidth = 210,
PageHeight = 297
};
Run Code Online (Sandbox Code Playgroud)
然后在CSS中,我设置一个具有210mm宽度的元素,它应该扩展页面的整个宽度,但在输出PDF中,210mm宽度不是表示PDF的整个宽度而是更少.通过反复试验,生成的PDF的总宽度似乎在附近246mm.
任何想法为什么会发生这种情况?
我们有一个项目,如果Views的.cshtml文件中有任何错误,我们希望构建视图以生成编译时错误.
不过,编译时间大幅增加:
MvcBuildViews = true 需要62秒MvcBuildViews = false 需要9秒这是可以接受的吗?因为增加是非常激烈的,我们不能忍受等待这样的编译时间.我们可以用任何方式改进这样的编译吗?
到目前为止,该项目包含130个视图和部分视图(.cshtml文件).这被认为是大/中/小?
有没有一种方法可以在单独的窗口中打开 Chrome 开发人员工具的特定选项卡?我有 3 台显示器,希望Sources在一个屏幕上和Elements另一个屏幕上都有选项卡。这可能吗?
有没有什么方法可以使强类型视图出现编译时错误。假设我在文件夹中有一个视图/Views/Home/Index.cshtml,其中包含以下代码和强类型模型:
@model CSTemplate.Models.Home.HomeIndexModel
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
Run Code Online (Sandbox Code Playgroud)
然后位于的控制器/Controllers/HomeController.cs将返回以下代码。
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
List<string> s = new List<string>();
return View(s);
}
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,由于 View() 接受对象作为模型,因此编译器不会抱怨模型无效,而是会输出运行时错误,即:
Server Error in '/' Application.
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[System.String]', but this dictionary requires a model item of type 'CSTemplate.Models.Home.HomeIndexModel'.
Run Code Online (Sandbox Code Playgroud)
在这种模型类型不匹配的情况下,有什么方法可以得到编译时错误而不是运行时错误,或者是否有任何解决方法?