草庐IT

SSL_CTX_use_certificate_chain_fil

全部标签

c# - 通过 using block 使用进程

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:WhathappensifIdon'tcloseaSystem.Diagnostics.ProcessinmyC#consoleapp?由于System.Diagnostics.Process继承自实现IDisposable的Component,我是否应该始终创建一个Process使用usingblock?例如,这个...:using(varprocess=newProcess()){process.StartInfo.FileName="someprocess.exe";process.Start();pr

c# - 三重 DES : Specified key is a known weak key for 'TripleDES' and cannot be used

我正在使用.NET3.0类System.Security.Cryptography.MACTripleDES类来生成MAC值。不幸的是,我正在使用使用“1111111111111111”(十六进制)作为单一长度DESkey的硬件设备。System.Security.Cryptography库会对key进行完整性检查,如果您尝试使用加密强度较弱的key,则会返回异常。例如:byte[]key=newbyte[24];for(inti=0;i抛出异常System.Security.Cryptography.CryptographicException:Specifiedkeyisaknow

c# - "Data Source cannot be empty. Use :memory: to open an in-memory database"是什么意思?

我最近将我的SQLServer数据库转换为SQLite数据库。但是当我尝试使用.Open()打开我的SQLite时,它​​抛出了这个错误:DataSourcecannotbeempty.Use:memory:toopenanin-memorydatabase编辑:添加连接字符串:ConnectionString=@"DataSource=D:\XXX.db;Version=3";connection=newSQLiteConnection(connectionString);connection.Open();为什么我会得到这个?我将相同的SQLServer数据库转换为SQLCE和my

c# - Using block 中的异步

我在C#中有以下异步函数:privateasyncTaskCallDatabaseAsync(Func>execAsync){using(varconnection=newSqlConnection(_connectionString)){connection.Open();returnawaitexecAsync(connection);}}它允许执行任何异步函数execAsync,该函数将SQL连接作为参数并使用它来进行数据库调用,方法是提供连接对象并确保其正确关闭。然后从WebApiController中的操作调用此函数,如下所示:publicasyncTaskMyAction(

c# - 属性规范中奇怪的歧义(两个 using 指令)

背景在attributespecification,有时有两种有效的方法来编写应用的属性。例如,如果属性类的名称为HorseAttribute,您可以将该属性应用为[HorseAttribute]或只是[Horse]。歧义可以用@解决,例如[@Horse]。以下是一个有效的程序:usingSystem;usingAlpha;usingBeta;namespaceN{[Horse]classC{}}namespaceAlpha{//validnon-abstractattributetypewithaccessibleconstructorclassHorseAttribute:Attr

c# - ASP.NET MVC : Views using a model type that is loaded by MEF can't be found by the view engine

我正在尝试创建一个框架,以允许将Controller和View动态导入到MVC应用程序中。到目前为止,它是这样工作的:我正在使用.NET4、ASP.NETMVC3RC和RazorViewEngine每个项目都使用MEF导出和导入Controller-我将给定项目中的一组Controller和View称为“模块”BuildManager使用应用前启动方法和BuildManager.AddReferencedAssembly动态引用使用MEF发现的程序集。使用构建事件将二进制文件(来自导出项目)和View复制到目标项目的文件夹结构中使用自定义Controller工厂选择Controller

c# - The non-generic method cannot be used with type arguments in this context 是什么意思?

我有以下类和方法:publicclassUserManager:IDisposablewhereTUser:class,global::Microsoft.AspNet.Identity.IUserwhereTKey:global::System.IEquatable{publicvirtualTaskFindByIdAsync(TKeyuserId);和:privateApplicationUserManager_userManager;publicApplicationUserManagerUserManager{get{return_userManager??Request.Ge

c# - 使用 Microsoft.Web.Administration 以编程方式安装 SSL 证书

因此Microsoft.Web.AdministrationAPI非常易于用于为站点创建HTTP和HTTPS绑定(bind):using(ServerManagermanager=newServerManager()){Sitesite=manager.Sites[siteName];site.Bindings.Clear();site.Bindings.Add("*:80:","http");site.Bindings.Add("*:443:","https");manager.CommitChanges();}但如果没有SSL证书,HTTPS绑定(bind)就毫无意义。如何使用此A

c# - 从 Azure Websites for Google API 中的 p12 证书生成 X509Certificate2 时出现 502 错误

我正在使用ThisGoogleJsonWebToken类以生成访问token,以与对GoogleCalendarAPI的json调用一起使用。当我使用以下内容(使用我的实际服务帐户电子邮件)时,它在我的开发机器上的IISExpress中工作得很好:stringp12Path=HttpContext.Current.Server.MapPath("~/App_Data/certificate.p12");varauth=GoogleJsonWebToken.GetAccessToken("uniquestring@developer.gserviceaccount.com",p12Pat

c# - LINQ 如何在 using 语句中延迟执行

假设我有以下内容:privateIEnumerableMyFunc(parametera){using(MyDataContextdc=newMyDataContext){returndc.tablename.Select(row=>row.parameter==a);}}privatevoidUsingFunc(){varresult=MyFunc(newa());foreach(varrowinresult){//Dosomething}}根据文档,linq执行将推迟到我实际枚举结果时,该结果出现在foreach的行中。但是,using语句应强制在调用MyFunct()结束时可靠地