我有一个部署到azure的Web应用程序,但我不知道如何记录错误.
出于测试目的,我有这个ForceError方法:
public string ForceError()
{
throw new Exception("just a test exception");
return "ok";
}
Run Code Online (Sandbox Code Playgroud)
但是我强制的错误没有出现在选定的存储容器中.
你知道我该怎么做才能开始记录应用程序中的所有错误吗?
我刚刚在Visual Studio Premium 2013中安装了Web Essentials以便使用LESS css.我将Site.css重命名为Site.less,保存并获得Compilation Error occurred (see error list to navigate to the error location):
在错误列表上: Error 1 RTLCSS: Exception occured: Cannot call method 'toJSON' of undefined Site.less
我对新手很少,并且不知道错误可能指的是什么.我在视觉工作室教程中遵循了一些开始,我相信我不会错过任何一步.
谢谢你的帮助!
我使用以下教程实现了数据库软删除(一个将条目标记为已删除的布尔标志):http://www.codeguru.com/csharp/csharp/soft-deleting-entities-cleanly-using-entity-framework- 6- interceptors.html
在我看来,这是一个非常好的实现,因为一旦设置了软删除,只需添加[SoftDelete("IsDeleted")]
注释就可以应用于模型.问题到目前为止它无法正常工作.
来源似乎是可靠的,他们甚至发布了他们的解决方案的一个例子:https://github.com/rakeshbabuparuchuri/EFExpensionPoints
在将软删除应用到我的项目中时,如果我做错了什么,你能看看我的代码吗?
这是模型:
[SoftDelete("IsDeleted")]
public class BC_Instance
{
public int ID { get; set; }
public bool IsDeleted { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
ApplicationDbContext.cs:
namespace bcplatform2.Models
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
// Add a DbSet for each one of your Entities
//public DbSet<VirtualGuest> VirtualGuests { get; set; }
public DbSet<BC_Instance> BiocloudInstances { get; set; }
static ApplicationDbContext()
{ …
Run Code Online (Sandbox Code Playgroud) 我正在使用代码优先迁移在ASP.NET中开发Web应用程序.它在本地工作正常,但在部署到Azure后,代码首次迁移不会执行.我一直在一步一步地学习本教程几次,但我无法发现我的设置有什么问题.这是相关代码:
DB上下文:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext() : base("DefaultConnection", throwIfV1Schema: false) {}
public DbSet<BC_Instance> BiocloudInstances { get; set; }
static ApplicationDbContext() {}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
var conv = new AttributeToTableAnnotationConvention<SoftDeleteAttribute, string>(
"SoftDeleteColumnName",
(type, attributes) => attributes.Single().ColumnName);
modelBuilder.Conventions.Add(conv);
}
}
Run Code Online (Sandbox Code Playgroud)
连接字符串:
(它在发布时被替换,但以防万一)
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=bcplatform2;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /></connectionStrings>
Run Code Online (Sandbox Code Playgroud)
Code First迁移配置
internal sealed class Configuration : DbMigrationsConfiguration<bcplatform2.Models.ApplicationDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled …
Run Code Online (Sandbox Code Playgroud) asp.net-mvc entity-framework azure ef-code-first ef-migrations
我使用 Angular AOT 编译器版本 4.1.3
我有一个组件库,它导出一个工厂方法,然后用于提供服务:
export function libServiceFactory(itemId: string) {
return (http: Http): LibService => {
return new LibService(http, itemId);
};
};
Run Code Online (Sandbox Code Playgroud)
我编译库与ngc
成功。
然后导入编译好的库,我LibServiceFactory
在网站的 AppModule 中使用:
providers: [
{ provide: SERVICE_TOKEN, useFactory: libServiceFactory('foo'), deps: [Http] }
],
Run Code Online (Sandbox Code Playgroud)
我编译网站,ng build
我收到以下错误:
ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 5:10 in the …
Run Code Online (Sandbox Code Playgroud) 我需要将 iframe 移动到不同的父元素,保持 iframe 状态(保留滚动位置和可能已输入表单的任何信息等)
当使用 iframe 元素移动时,appendChild()
它也会重新加载,从而重置状态。有可能阻止这种情况吗?
我创建了一个实例来说明这一点。https://jsbin.com/kejoweniva/edit?output
打开示例,滚动然后单击按钮,当附加到新的父级时,iframe 会自动重新加载。
html
<div class="target"></div>
<iframe src="https://2017.cssconf.eu/"></iframe>
<button onclick="moveIframe()">move iframe</button>
Run Code Online (Sandbox Code Playgroud)
javascript
function moveIframe() {
console.log('moving iframe')
var iframe = document.getElementsByTagName('iframe')[0]
document.getElementsByClassName('target')[0].appendChild(iframe)
}
Run Code Online (Sandbox Code Playgroud) I wanted to create an anonymous C# object with no class definition. Similar to javascript object. Sample code not working:
var data = new
{
groups = new object[] {
new {
header = "Facebook",
buttons = new object[] {
new {
label = "Create new post"
}
}
}
}
};
Run Code Online (Sandbox Code Playgroud) asp.net ×3
c# ×3
azure ×2
angular ×1
angular-aot ×1
arrays ×1
asp.net-mvc ×1
database ×1
html ×1
iframe ×1
javascript ×1
json ×1
less ×1
object ×1
soft-delete ×1