小编Tom*_*son的帖子

是什么导致错误"无法从释放的脚本执行代码"

我以为我之前找到了解决方案(参见我的博客):

如果你得到JavaScript(或者应该是JScript)错误"无法从释放的脚本中执行代码" - 尝试移动头部中的任何元标记,使它们位于脚本标记之前.

...但基于最新的博客评论之一,我建议的修复可能不适用于所有人.我认为这对开放StackOverflow社区来说是一个很好的....

是什么导致错误"无法从释放的脚本执行代码"以及解决方案/解决方法是什么?

javascript internet-explorer

63
推荐指数
6
解决办法
8万
查看次数

安装包时NuGet添加引用错误

我无法通过Nuget安装任何软件包.例如,当我想要安装实体框架时,我收到以下错误:

install-package EntityFramework
Successfully installed 'EntityFramework 4.2.0.0'.
Successfully uninstalled 'EntityFramework 4.2.0.0'.
Install failed. Rolling back...
Install-Package : Failed to add reference to 'EntityFramework'.
At line:1 char:16
+ install-package <<<<  EntityFramework
   + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
   +FullyQualifiedErrorId:NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Run Code Online (Sandbox Code Playgroud)

从console或gui安装每个软件包时收到同样的错误.重新安装nuget,禁用其他扩展和运行VS作为管理员没有帮助我.

问候

.net visual-studio-2010 nuget

55
推荐指数
5
解决办法
7万
查看次数

在视图中确定ASP.NET Core环境名称

新的ASP.NET Core框架使我们能够为不同的环境执行不同的html:

<environment names="Development">
    <link rel="stylesheet" href="~/lib/material-design-lite/material.css" />
    <link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment names="Staging,Production">
    <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
          asp-fallback-href="~/lib/material-design-lite/material.min.css"
          asp-fallback-test-class="hidden" asp-fallback-test-property="visibility" asp-fallback-test-value="hidden"/>
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>
</environment>
Run Code Online (Sandbox Code Playgroud)

但是,如何在_Layout.cshtml ASP.NET Core MVC Web应用程序中确定和可视化当前环境的名称

例如,我想将环境名称(Production,Staging,Dev)可视化为HTML注释,以便进行调试:

<!-- Environment name: @......... -->
Run Code Online (Sandbox Code Playgroud)

view environment-variables asp.net-core-mvc asp.net-core

41
推荐指数
4
解决办法
1万
查看次数

是否可以仅使用C#以编程方式生成X509证书?

我们正在尝试使用C#和BouncyCastle库以编程方式生成X509证书(包括私钥).我们尝试使用Felix Kollmann的这个示例中的一些代码,但证书的私钥部分返回null.代码和单元测试如下:

using System;
using System.Collections;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.Crypto.Prng;
using Org.BouncyCastle.Math;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.X509;

namespace MyApp
{
    public class CertificateGenerator
    {
        /// <summary>
        /// 
        /// </summary>
        /// <remarks>Based on <see cref="http://www.fkollmann.de/v2/post/Creating-certificates-using-BouncyCastle.aspx"/></remarks>
        /// <param name="subjectName"></param>
        /// <returns></returns>
        public static byte[] GenerateCertificate(string subjectName)
        {
            var kpgen = new RsaKeyPairGenerator();

            kpgen.Init(new KeyGenerationParameters(new SecureRandom(new CryptoApiRandomGenerator()), 1024));

            var kp = kpgen.GenerateKeyPair();

            var gen = new X509V3CertificateGenerator();

            var certName = new X509Name("CN=" + subjectName); …
Run Code Online (Sandbox Code Playgroud)

c# bouncycastle pki x509certificate x509

40
推荐指数
2
解决办法
3万
查看次数

为什么我在安装IE8后无法从Visual Studio 2005进行调试?

我刚刚安装了IE8(最终版)并重新启动.我无法再在Windows Server 2003 Enterprise R2上使用Visual Studio 2005调试Web应用程序项目.我收到消息"Internet Explorer无法显示网页",然后WebDev.WebServer.exe退出,没有可见的错误消息,事件查看器中没有任何内容.

有没有人有任何想法?

没有帮助的事情:

  • 将localhost添加到可信站点
  • 将端口更改为8080或80
  • 检查我的hosts文件(它只有127.0.0.1 localhost)

有点帮助的事情:

  • 用CTRL-F5运行(不调试),工作正常(除非你需要调试)
  • 将默认的Visual Studio浏览器更改为Firefox,这允许我进行调试

我的主机文件包含:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# …
Run Code Online (Sandbox Code Playgroud)

asp.net debugging visual-studio-2005 internet-explorer-8

32
推荐指数
1
解决办法
3万
查看次数

AngularJS应用程序文件结构

在一个大型的AngularJS应用程序中,我的所有控制器都在一个"controllers.js"文件中,对我来说似乎有点难以维护.有没有更好的方法来做到这一点,如:

\js\controllers\myController.js
\js\controllers\yourController.js
\js\controllers\ourController.js
Run Code Online (Sandbox Code Playgroud)

这也适用于过滤器,服务,指令等......

javascript directory-structure angularjs

30
推荐指数
2
解决办法
4万
查看次数

我可以在索引的子文档字段上执行MongoDB"start with"查询吗?

我正在尝试查找字段以值开头的文档.

使用notablescan禁用表扫描.

这有效:

db.articles.find({"url" : { $regex : /^http/ }})
Run Code Online (Sandbox Code Playgroud)

这不是:

db.articles.find({"source.homeUrl" : { $regex : /^http/ }})
Run Code Online (Sandbox Code Playgroud)

我收到错误:

error: { "$err" : "table scans not allowed:moreover.articles", "code" : 10111 }
Run Code Online (Sandbox Code Playgroud)

两者都有索引urlsource.homeUrl:

{
    "v" : 1,
    "key" : {
        "url" : 1
    },
    "ns" : "mydb.articles",
    "name" : "url_1"
}

{
    "v" : 1,
    "key" : {
        "source.homeUrl" : 1
    },
    "ns" : "mydb.articles",
    "name" : "source.homeUrl_1",
    "background" : true
}
Run Code Online (Sandbox Code Playgroud)

对子文档索引的正则表达式查询有任何限制吗?

regex indexing search mongodb full-table-scan

29
推荐指数
1
解决办法
5万
查看次数

使用Moq模拟具有内部构造函数的类型

我正在尝试从Microsoft Sync Framework模拟一个类.它只有一个内部构造函数.当我尝试以下内容时:

var fullEnumerationContextMock = new Mock<FullEnumerationContext>();
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

System.NotSupportedException:Parent没有默认构造函数.必须显式定义默认构造函数.

这是堆栈跟踪:

System.Reflection.Emit.TypeBuilder.DefineDefaultConstructorNoLock(MethodAttributes attributes)System.Reflection.Emit.TypeBuilder.DefineDefaultConstructor(MethodAttributes attributes)System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()System.Reflection.Emit.TypeBuilder.CreateType()Castle. DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType()Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type [] interfaces,ProxyGenerationOptions options)Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxy(Type classToProxy,Type [] additionalInterfacesToProxy,ProxyGenerationOptions options)Castle. DynamicProxy.ProxyGenerator.CreateClassProxyType(Type classToProxy,Type [] additionalInterfacesToProxy,ProxyGenerationOptions options)Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy,Type [] additionalInterfacesToProxy,ProxyGenerationOptions options,Object [] constructorArguments,IInterceptor [] interceptors)Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy,Type [] additionalInterfacesToProxy,ProxyGenerationOptions options,IInterceptor [] interceptors)Castle.DynamicProxy .ProxyGenerator.CreateClassProxy(类型classToProxy,Type [] additionalInterfacesToProxy,IInterceptor []拦截器)Moq.MockDynamicProxy.ProxyGenerator.CreateClassProxy(类型classToProxy,Type [] additionalInterfacesToProxy,IInterceptor []拦截器)Moq.MockDynamicProxy.ProxyGenerator.CreateClassProxy(类型classToProxy,Type [] additionalInterfacesToProxy,IInterceptor []拦截器)Moq.Mock1.<InitializeInstance>b__0() Moq.PexProtector.Invoke(Action action) Moq.Mock1.InitializeInstance()

我该如何解决这个问题呢?

c# unit-testing moq microsoft-sync-framework

27
推荐指数
2
解决办法
2万
查看次数

当达到100%时,如何停止WPF ProgressBar脉冲/动画?

我有一个基于MVVM的WPF 4应用程序,它使用ProgressBar来显示长时间运行的操作的完成百分比.

<ProgressBar Name="ProgressBar"
    IsIndeterminate="False"
    Minimum="0"
    Maximum="100"
    Value="{Binding Path=ProgressPercentageComplete, Mode=OneWay}"
    Visibility="Visible"/>
Run Code Online (Sandbox Code Playgroud)

我很高兴在进度条移动时发生"脉冲"动画,但一旦达到100%,我希望它停止动画并保持静态100%.

我尝试过设置,IsIndeterminate="False"但这没有用,我在阅读MSDN文档后可以看到原因:

当此属性为true时,ProgressBar会以连续的方式设置几个在ProgressBar中移动的条形图并忽略Value属性.

是否可以停止此动画?完全,或只是100%.

wpf mvvm progress-bar

27
推荐指数
3
解决办法
1万
查看次数

Common.Logging还有其他选择吗?

编辑:Common.Logging 2.1.1于2012年6月9日发布,Github页面相当活跃,作者专门评论了项目的健康状况.

我们正在考虑在新的.NET项目中使用Common.Logging,但我有点担心项目似乎变得不活跃.该主页最后一次更新于2009年,SourceForge上最新版本于2010年创建.我已经发现与NLog 2不兼容,我担心随着时间的推移,这可能会成为一个更大的问题.我注意到Enterprise Library 5.0没有列为兼容,但我没有尝试过.

是否有其他替代方案可提供类似的通用接口?

.net logging nlog common.logging

21
推荐指数
1
解决办法
7007
查看次数