草庐IT

set_no_cache

全部标签

c# - 为什么 EPPlus 告诉我 "Can' t set color when patterntype is not set"当我设置了 PatternType 时?

我有这段代码来尝试设置标题行的样式:worksheet.Cells["A32:D32"].Style.Font.Name="Georgia";worksheet.Cells["A32:D32"].Style.Font.Bold=true;worksheet.Cells["A32:D32"].Style.Font.Size=16;worksheet.Cells["A32:D32"].Style.Fill.PatternType=ExcelFillStyle.Solid;worksheet.Cells["A32:D33"].Style.Fill.BackgroundColor.SetCol

c# - "Cannot be determined because there is no implicit conversion"如果返回则为三进制

如果返回,我有以下ASP.NETWebApi2操作和三元:[HttpDelete]publicIHttpActionResultDelete(){booldeleted;//...returndeleted?this.Ok():this.NotFound();}我收到一个Typeofconditionalexpressioncannotbedeterminedbecausethereisnoimplicitconversionbetween'System.Web.Http.Results.OkResult'and'System.Web.Http.Results.NotFoundResu

c# - HttpRuntime.Cache 和 Session 有什么区别?

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:Cachev.sSession我正在使用一些使用HttpRuntime.Cache来存储值的代码。但是,当我关闭窗口时,缓存消失了。在Session上使用它有什么好处吗?这是我的代码:protecteddynamicCode(){dynamiccode;if(String.IsNullOrEmpty(myHttpContext.Request.QueryString["code"])){code=HttpRuntime.Cache["code"];}else{code=myHttpContext.Reques

c# - Cache.SetMaxAge 在 IIS 下不工作,在 VS Dev Srv 下工作正常

我试图在我的回复中添加一个“max-age”标题。它在我的VisualStudio开发服务器上运行良好,但是一旦我将应用程序移动到IIS(尝试了本地IISExpress和服务器上的IIS)-标题就消失了。我的代码:Response.Cache.SetCacheability(HttpCacheability.Public);Response.Cache.SetMaxAge(newTimeSpan(1,0,0,0));VS开发服务器响应(一切正常):HTTP/1.1200OKServer:ASP.NETDevelopmentServer/10.0.0.0Date:Fri,07Jan201

c# - 如何在设计时避免 XAML 代码中出现 "object reference not set to an instance of an object"异常?

我自己设计的wpf用户控件有问题。问题是,当我在我的程序中实现用户控件时,在设计时XAML代码中出现objectreferencenotsettoaninstanceofanobject异常。设计师向我展示了以下信息:atMicrosoft.Expression.Platform.InstanceBuilders.InstanceBuilderOperations.InstantiateType(Typetype,BooleansupportInternal)atMicrosoft.Expression.Platform.InstanceBuilders.ClrObjectInstan

c# - Autofac - 自动注册错误 : No constructors can be found with 'Public binding flags'

这是我的Global.asax.cspublicvoidRegisterContainersUsingAutofac(){//http://elegantcode.com/2009/01/07/ioc-libraries-compared///http://www.codeproject.com/Articles/25380/Dependency-Injection-with-Autofac//https://code.google.com/p/autofac///http://api.autofac.org/varbuilder=newContainerBuilder();build

c# - 可以找到 Entity Framework 迁移 "No connection string named ' DefaultConnection ......”

过去几个月我一直在使用MVC5和EntityFramework6。我已将我的主要模型/业务逻辑和“迁移”分离到一个单独的程序集,并在我的Web应用程序中引用它。迁移一直运行良好。今天我运行“更新数据库”,我得到“在应用程序配置文件中找不到名为‘DefaultConnection’的连接字符串。”“DefaultConnection”仍在我的web.config文件中。如果我将该部分复制到迁移所在的项目,它将再次运行。如果我删除该部分,它会抛出该错误。我不知道可能发生了什么变化。从昨天开始我唯一做的就是运行“磁盘清理”来清理我硬盘​​上的空间。 最佳答案

c# - 使用 System.Web.Caching.Cache

我正在尝试使用缓存,但出现以下错误。如何正确使用缓存?protectedvoidPage_Load(objectsender,EventArgse){x=System.DateTime.Now.ToString();if(Cache["ModifiedOn"]==null){//firsttimesonokey/valueinCacheCache.Insert("ModifiedOn",x);//insertsthekey/valuepair"ModifiedOn",x}else{//Key/valuepairalreadyexistsinthecachex=Cache["Modifi

c# - 如何为数组数据成员定义 get 和 set?

我正在创建一个类Customer,它具有以下数据成员和属性:privatestringcustomerName;privatedouble[]totalPurchasesLastThreeDays;//arrayof3elementsthatwillholdthetotalsofhowmuchthecustomerpurchasedforthepastthreedaysi.e.element[0]=100,element[1]=50,element[2]=250publicstringCustomerName{get{returncustomerName;}set{customerNa

c# - System.StackOverflowException ,何时使用 get set 属性?

在wcfserviceLibrary.DLL中发生类型为“System.StackOverflowException”的未处理异常代码如下。[DataContract]publicclassmemberdesignations{[DataMember]publicstringDesigId{get{returnDesigId;}set{DesigId=value;}}[DataMember]publicstringDesignationName{get{returnDesignationName;}set{DesignationName=value;}}}然后我有如下的Typememb