我们有一个运行在两个负载平衡服务器上的网站.我们使用ASP.Net缓存来缓存高使用率数据,从而帮助提高性能.但是,偶尔会有数据发生变化.当它发生时,我们需要清除负载平衡服务器上的相关缓存项.有没有人有一些容易实施的建议如何做到这一点?
我知道有一些软件可以为你管理(Microsoft Velocity for one).我也知道有其他选择可以使用单独的状态服务器等.但是,对于我们想要的东西,它们看起来都有点过分.我们现在只需要一种简单的机制来清除服务器上的特定缓存项.
谢谢你的任何建议.
我在事件日志中看到以下错误.它来自我们的ASP.Net应用程序.我无法追踪导致错误的原因.任何建议赞赏!
错误日志
[MachineName]已为IIS记录以下错误
详细信息:ComputerName = [ComputerName] User =未指定Logfile =应用程序类型=错误EventType = 1 SourceName = ASP.NET 2.0.50727.0 Category = 0 CategoryString =未指定EventCode = 1334 EventID = -1073740490 TimeGenerated = 20091125101806.000000-360 TimeWritten = 20091125101806.000000 -360 Message =发生未处理的异常并终止进程.
应用程序ID:DefaultDomain进程ID:1440异常:System.Runtime.Serialization.SerializationException消息:无法找到程序集"Company.Common,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null".
StackTrace:位于System.Runtime.Serialization.Formatters.Binary的System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo,String name)中的System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly(). ObjectMap..ctor(字符串对象名,字符串[] memberNames,BinaryTypeEnum [] binaryTypeEnumA,对象[] typeInformationA,的Int32 [] memberAssemIds,objectReader objectReader,的Int32的ObjectID,BinaryAssemblyInfo集信息,SizedArray assemIdToAssemblyTable)
在System.Runtime.Serialization.Formatters.Binary .__ BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)System.Runtime.Serialization.Formatters.Binary .__ BinaryParser.Run()at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler,__BinaryParser serParser,Boolean fCheck,Boolean isCrossAppDomain) ,System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream seri)中的IMethodCallMessage methodCallMessage)在System.AppDomain.UnmarshalObject(Byte)的System.AppDomain.Deserialize(Byte [] blob)的System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)处的alizationStream,HeaderHandler处理程序,Boolean …
使用ASP.Net Ajax调用PageMethods时,如何从"success"方法访问Http响应头?
例如:
PageMethods.DoSomething(
function(result){successMethod(result)},
function(error){errorMethod(error)}
);
function successMethod(result){
//------how can I access the Http response headers from here? ------
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助
我正在努力找到找到我的Ninject配置"模块"(指定类型绑定的地方)的最佳位置.我希望我只是错过了一些明显的技巧,因为使用流畅的配置(因此Ninject)开始变成了一个交易破坏者:
在一个包含三个独立项目的简单Web堆栈中:Web,BusinessLogic,DataAccess.我不希望Web层必须直接引用DataAccess层,但我无法看到解决方法,因为:
如果我将DataAccess配置模块放在DataAccess层中,我必须引用DataAccess层,这样我就可以在Web层中实例化Ninject内核时访问配置模块
如果我将DataAccess配置模块放在Web层中,我必须引用DataAccess层才能访问我想要绑定的类型
如果我将DataAccess配置模块放在单独的配置项目中,那么在尝试为web和DataAccess层指定绑定时,我最终会遇到循环引用问题.
IOC的部分好处是允许松散耦合,但据我所知,使用Ninject需要我添加更多我目前拥有的直接项目引用.我错过了什么?
.net configuration dependency-injection ninject inversion-of-control
使用KnockoutJS自定义绑定我试图在被Knockout删除之前淡出DOM元素.我有一个JSFiddle示例,当列表选择更改时,当前的行为如下:
但是,我想:
这可能吗?我无法看到一种方法来操作即将被删除的DOM元素.以下Update方法仅在已删除之后(但在添加新DOM元素之前)触发.
ko.bindingHandlers.fade= {
update: function(element, valueAccessor) {
$(element).hide().fadeIn(1500);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Global.asax通过Application_EndRequest事件在每个请求结束时执行日志记录.但是,我看到HTTPContext.Current.Items集合中存储的某些值的奇怪行为.
下面是可以为空的枚举的调试输出.您可以看到有一个值,但HasValue已解析为False?!
{System.Nullable(Of AreaNameEnum)}
HasValue: False
hasValue: False
Value: {System.InvalidOperationException}
value: ADMIN {0}
Run Code Online (Sandbox Code Playgroud)
我猜测在请求生命周期中访问HTTPContext.Current已经太晚了 - 但它似乎有时可行,有时却不行.任何人都可以更清楚地了解到底发生了什么?
谢谢
将控件添加到UpdatePanel时,仍然可以从包含页面后面的代码访问它.这是如何实现的?自定义控件开发人员可以这样做吗?
换句话说,如果我使用ITemplate接口开发模板控件,是否有一种方法可以将其连接起来(如UpdatePanel似乎),以便可以从包含页面访问(声明性地)包含的任何控件?
我正在尝试使用Cruise Control 预处理器功能将我的配置分成较小的可重用部分。我可以在根巡航控制节点内使用很棒的包含功能,如下所示:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<cb:include href="child.config" />
</cruisecontrol>
Run Code Online (Sandbox Code Playgroud)
如果我尝试在子配置中使用另一个包含项(如下所示):
<project name="TestProject" xmlns:cb="urn:ccnet.config.builder">
<cb:include href="grandchild.config" />
</project>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
ThoughtWorks.CruiseControl.Core.Config.ConfigurationException:检测到未使用的节点:xmlns:cb =“ urn:ccnet.config.builder”
如果删除xmlns名称空间语句,则会收到此错误:
ThoughtWorks.CruiseControl.Core.Config.ConfigurationException:配置文件包含无效的xml:E:\ Build \ Config \ AppRiver.Tools.BuildAutomation \ CruiseControl \ ccnet.config ---> System.Xml.XmlException:'cb'是一个未声明的名称空间。
最后,如果我删除标签上的“ cb”前缀,则会收到此错误
Unused node detected: Unused node detected: <define buildFile="CP.WEB.Dev.SanityCheck.CI.build" />
Run Code Online (Sandbox Code Playgroud)
我没主意-任何帮助表示赞赏!
我正在努力弄清楚哪些.Net认证概念在OWIN的世界中仍然相关,现在已经过时了.从OWIN之前的ASP.Net时代开始,我习惯于处理.Net结构:FormsAuthentication,FormsAuthCookie,IPrincipal,IIdentity以及IPrincipal的自定义实现(继承自GenericPrincipal).使用最新版本的MVC(5),许多身份验证似乎已经改为基于OWIN.我特别想要了解的两件事:
1)IPrincipal和IIdentity以及GenericPrincipal在哪里适合? 使用FormsAuthentication,自定义数据可以存储在FormsAuth cookie中.然后,可以在ASP.Net PostAuthenticate事件中使用它来创建CustomPrincipal对象,并覆盖HTTPContext上的默认IPrincipal(下面的代码示例).OWIN如何(或确实)改变了这个?:
protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
{
//Decrypt forms authentication cookie and retrieve some userdata
...
//Create CustomPrincipal (which inherits from GenericPrincipal)
var principal = new CustomPrincipal(userId, roles, someAdditionalUserDataFromCookie);
//Replace standard IPrincipal object on HTTPContext with custom principal
HttpContext.Current.User = newUser
}
Run Code Online (Sandbox Code Playgroud)
2)哪里可以存储自定义身份验证数据?在OWIN之前的日子里,我使用AuthCookie的UserData值来存储自定义标识信息(除了用户名) - 例如OrgID.现在可以将它存储为ClaimsIdentity对象中的声明吗?这是一个好主意吗?它仍然可以存储在AuthenticationTicket中吗?我看这一切都错了吗?!
谢谢你的帮助.
我正在尝试使用MongoDB C#驱动程序将项目添加到BSON文档内的嵌套数组中。我已经搜索过SO,但是到目前为止我发现的所有示例都与我尝试做的不匹配。
我在蒙哥有一个顶级的“组织”收藏。它包含多个具有以下结构的组织对象:
{
"id":"Org1",
"Name":"First Org",
"Divisions":[
{
"id":"Div1",
"Name":"First Division",
"UsersInDivision":[
"User1",
"User2"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
我有以下POCO课程
public class Organization
{
public string Id { get; set; }
public string Name { get; set; }
public IList<Division> Divisions { get; set; }
}
public class Division
{
public string Id { get; set; }
public string Name { get; set; }
public IList<string> UsersInDivision { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想将字符串“ User3”添加到“ Div1”或组织“ Org1”的UsersInDivision集合中。实现此目标的最佳方法是什么?我正在尝试尽可能使用MongoDB数据访问类的强类型版本。
任何人都可以推荐.Net XML序列化库(理想情况下是开源的).
我正在寻找一个强大的XML序列化库,我可以抛出任何对象,这将产生用于记录目的的公共属性的人类可读XML表示.
任何建议赞赏!
谢谢
.net ×7
asp.net ×6
javascript ×2
ajax ×1
architecture ×1
asp.net-mvc ×1
c# ×1
caching ×1
code-behind ×1
debugging ×1
event-log ×1
global-asax ×1
iis ×1
itemplate ×1
knockout.js ×1
logging ×1
mongodb ×1
nant ×1
ninject ×1
nullable ×1
owin ×1