可能重复:
.NET反射的代价是多少?
我目前处于一种编程心态,反思是我最好的朋友.我使用它来动态加载内容,允许"松散实现"而不是严格的接口,以及许多自定义属性.
使用反射的"实际"成本是多少?
经常反映的类型是否值得缓存反射,例如我们自己的LINQ DAL目标代码在表定义的所有属性上?
缓存内存占用量是否会超过反射CPU的使用量?
我有一个从主网站发回的一些JSON帖子中使用的URL:
HTTP://site/Services/api.svc/UpdateItem
我们正在慢慢更新网站到ASP.Net MVC 2,并且不想破坏系统中的任何当前URL.(JavaScript刷新问题)
我删除了/Services/api.svc并将此API调用的逻辑移动到以下Controller中:
HTTP://网站/ LegacyApi /的updateItem
不幸的是,在添加路由时,我似乎无法覆盖api.svc并继续收到404错误.
路线:
routes.MapRoute(
"UpdateItemApi",
"Services/api.svc/UpdateItem",
new { controller = "LegacyApi", action = "UpdateItem" }
);
Run Code Online (Sandbox Code Playgroud)
根据MSDN对这个具体问题,路由应该通过.
非常感谢任何帮助.
标准.aspx页面的路由按预期工作,因此这似乎与.svc文件及其处理方式有关.
既然idselector已经升级到RPXNow并且你不能"只使用"选择器代码,那么什么是好的替代品呢?
我想在我正在使用的新网站上实现OpenId,但是用户在登录时会非常愚蠢,除非我为他们提供了一种简单的方法.
作为参考,我将使用.Net Open Id作为ASP.Net MVC Web应用程序的后台.
编辑
我目前正在通过以下操作与Google Chrome进行竞争:
location.href = url
Run Code Online (Sandbox Code Playgroud)
location.replace(url)
Run Code Online (Sandbox Code Playgroud)
document.location = url
Run Code Online (Sandbox Code Playgroud)
window.navigate(url) // doesn't work in Chrome/Firefox
Run Code Online (Sandbox Code Playgroud)
location.assign(url)
Run Code Online (Sandbox Code Playgroud)
window.open(url, '_self')
Run Code Online (Sandbox Code Playgroud)
window.location.href = url
Run Code Online (Sandbox Code Playgroud)
我已经尝试了所有,并且都不会添加历史记录条目.Google Chrome中是否有办法使用历史记录进行javascript重定向?
谢谢.
解释 我们有一个项目表,当点击该行时,我希望页面导航到指定的URL,如果有人有一个很好的解决方案,除了使用我们现在使用的onclick = send方法,请告诉我.
更新 似乎Stackoverflow它自己也有同样的问题.在主视图中,单击问题列表中的前3列之一(#answers等等),然后单击后退按钮,它将返回2页.
所以我正在处理一些电子邮件标题数据,对于to:,from:,cc:和bcc:fields,电子邮件地址可以用多种不同的方式表示:
First Last <name@domain.com>
Last, First <name@domain.com>
name@domain.com
Run Code Online (Sandbox Code Playgroud)
这些变体可以以任何顺序出现在同一个消息中,所有这些变量都以逗号分隔的字符串形式出现:
First, Last <name@domain.com>, name@domain.com, First Last <name@domain.com>
Run Code Online (Sandbox Code Playgroud)
我一直试图想出一种方法将这个字符串解析成单独的名字,姓氏,每个人的电子邮件(如果只提供了一个电子邮件地址,则省略名称).
有人可以建议最好的方法吗?
我试图在逗号上拆分,除了在第一个放置姓氏的第二个例子之外,它会起作用.我想这个方法可以工作,如果我拆分后,我检查每个元素,看它是否包含'@'或'<'/'>',如果没有,那么可以假设下一个元素是名字.这是解决这个问题的好方法吗?我是否忽略了地址可能存在的另一种格式?
更新:也许我应该澄清一点,基本上我要做的就是将包含多个地址的字符串分解为包含地址的单个字符串,无论发送的格式是什么.我有自己的方法来验证和提取信息从一个地址来看,找出分隔每个地址的最佳方法对我来说简直太棘手了.
以下是我想出的解决方案:
String str = "Last, First <name@domain.com>, name@domain.com, First Last <name@domain.com>, \"First Last\" <name@domain.com>";
List<string> addresses = new List<string>();
int atIdx = 0;
int commaIdx = 0;
int lastComma = 0;
for (int c = 0; c < str.Length; c++)
{
if (str[c] == '@')
atIdx = c;
if (str[c] == ',')
commaIdx = c;
if (commaIdx > atIdx && …Run Code Online (Sandbox Code Playgroud) 在app.config中为简化的WCF配置需要做的最小客户端设置是什么?
默认的是:
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
我可以排除什么,以及我需要多少?
编辑:我应该开始扯掉零件直到它破裂吗?我希望找到一些优秀的wsHttpBindings,让人们好运.
我是一位非常有经验的MS Sql开发人员,我将在几天内与Oracle合作开展一些新的职位.
与我学到的所有技术一样,我想知道最好的地方和书籍,以及使用Oracle设计和开发的速度,并使用纯C#.
有什么资源让我们微软的员工可以加入Oracle并与之合作?我意识到有oracle.com和asktom.oracle.com,以及关于Oracle的大量文档,我正在寻找一个快速入门(设置服务器,获取一些样本数据等). .)而不是深入sql与oracle技术的比较.
提前致谢.
我最近一直在思考有关屏幕抓取的问题,以及它可以完成的任务.所以我提出以下问题.
您作为网站开发人员是否会公开简单的API以防止用户屏幕抓取,例如JSON结果?
然后,这些结果可以实现缓存,并且它们的流量要小于可能下载的大量标记.
我不是在考虑预防,而是在阻止刮擦.
刮刮带宽样本
((用户*(%/ 100))*((freq*60)*24))*文件大小
式:
((users*(%/ 100))*((freq*60)*24))*filesize
10,000*1440*1
14400000kb或13.73291015625gb
假设您的JSON结果是200字节,现在是(10,000*1440*0.2)或2.74658203125gb一天.
这是每天约11GB流量的变化.
我的Stack Overflow配置文件为96k以供参考.
这个问题的原因促使用户档案要求获得JSON结果:http:
//stackoverflow.uservoice.com/pages/general/suggestions/101342-add-json-for-user-information
我想知道其他开发人员是否会公开这种类型的API,以及是否值得花时间提供这些API以减少带宽.
我目前正在使用TFS 2013(本地安装)尝试使用LDAP身份验证从内部GitHub Enterprise安装进行构建.
我得到的问题是它无法访问源代码,如何配置TFS Build以使用特定的身份验证?
从TFS构建日志
异常消息:libgit2引发了一个错误.Category = Net(错误).
VS30063:您无权访问https:// user:password@githubrepository.corp.company.net.(输入LibGit2SharpException)
异常数据字典:
libgit2.code = -1
libgit2.category = 11
异常堆栈跟踪:
服务器堆栈跟踪:
在LibGit2Sharp.Core.Ensure.HandleError(的Int32结果)在LibGit2Sharp.Core.Proxy.git_clone(字符串URL,字符串WORKDIR,GitCloneOptions选择采用)在LibGit2Sharp.Repository.Clone(字符串sourceUrl,字符串workdirPath,布尔裸露,布尔结帐,TransferProgressHandler System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md,Object []上的Microsoft.TeamFoundation.Build.Activities.Git.GitPull.GitClone.GetRepository(String repositoryUrl,String workingFolder)上的onTransferProgress,CheckoutProgressHandler onCheckoutProgress,Credentials credentials)指定参数时,对象服务器,对象[]&outArgs)在System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(即时聊天味精,IMessageSink replySink)
在[0]处重新抛出异常:
在System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(消息reqMsg,布尔bProxyCase)在System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(对象NOTUSED,MessageData&MSGDATA)在System.Func
3.EndInvoke(IAsyncResult result) at Microsoft.TeamFoundation.Build.Activities.Git.GitPull.GitRepositoryBase.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity1.System.Activities.IAsyncCodeActivity. FinishExecution(AsyncCodeActivityContext上下文,IAsyncResult的结果)在System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor执行者,bookmarkManager bookmarkManager)
跟进
我尝试过URL params进行身份验证(示例)
更多跟进
完全卸载并更新到2013 RC,错误消息也已更新,因为它是不同的.
我还尝试将构建控制器设置为在github企业安装中作为经过身份验证的LDAP用户运行.
我遇到了一个非常糟糕的问题,无论我尝试什么,用户都会在10分钟后退出.
我正在使用运行在作为虚拟服务器的Server 2003 R2 Standard Edition上的IIS 6.0上运行的ASP.Net 2.0以及所有适用的更新和.Net 3.5 SP1.
客户端是Internet Explorer 7.0
以下是web.config设置:
<!-- Authentication Mode -->
<authentication mode="Forms">
<forms name=".RecipeViewer" timeout="240" />
</authentication>
Run Code Online (Sandbox Code Playgroud)
以下是用于设置授权cookie的代码:
Private Sub SetCookie(userName)
' Use security system to set the UserID within a client-side Cookie
Dim ticket As New FormsAuthenticationTicket(1,userName, DateTime.Now, DateTime.Now.Add(Me.GetFormsAuthSettings.Forms.Timeout), True, String.Empty, FormsAuthentication.FormsCookiePath)
Dim hash As String = FormsAuthentication.Encrypt(ticket)
Dim cookie As New HttpCookie(FormsAuthentication.FormsCookieName, hash)
cookie.HttpOnly = True
If (ticket.IsPersistent) Then
cookie.Expires = ticket.Expiration
End If
Response.Cookies.Add(cookie)
' Redirect browser back to …Run Code Online (Sandbox Code Playgroud) .net ×5
c# ×4
api ×1
app-config ×1
asp.net ×1
asp.net-mvc ×1
cookies ×1
html ×1
javascript ×1
json ×1
libgit2 ×1
libgit2sharp ×1
openid ×1
optimization ×1
oracle ×1
parsing ×1
reflection ×1
rpxnow ×1
sql-server ×1
tfs ×1
tfs2013 ×1
tfsbuild ×1
url-routing ×1
wcf ×1
web-config ×1