from : http://blog.csdn.net/nileel/article/details/3519744
編譯完項目,訪問,經常出現“配置錯誤”,行***<add assembly="*"/>,某“DLL”文件拒绝访问。重启IIS也不行,重新编译也不对,基本每天都能遇到,频繁的时候编译一次遇到一次。狠狠的百度了一番,终于明白了。原来是windows的索引服务在搞鬼。windows的索引服务对asp.net的临时目录编制索引时,锁定了临时文件的访问权限,因此报错!
知道了原因,就好辦了
最簡單的解決辦法就是禁用索引服務,但是影響比較大。
可以刪除的PDB文件,但是調試的時候不方便
最後我採用的解決辦法是:
配置ASP.net的臨時目錄不受索引服務服務的影響的步驟如下:
1,開始 - 管理工具 - 計算機管理(Win2003的的位置,其他操作系統類似)打開計算機管理
2、展开计算机管理左边树中“服务和应用程序”节点,再在其下展开“索引服务”节点,再在其下展开“System”节点,再在其下展开“目录”节点。
3,在計算機管理的右邊我們可以看到配置的索引服務目錄。
4,在“目錄”節點上右擊鼠標,選擇“新建” - “目錄”
5,在“添加目錄”對話框中,路經輸入框中輸入ASP.net的臨時文件目錄默認應該是:
C :/ WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files文件/
6,在“包含在索引中嗎?”選項中,選擇“否”
7,單擊“確定”按鈕
8,在“索引服務”節點上右鍵單擊,重起索引服務即可。
2014年7月15日 星期二
2014年7月7日 星期一
[C#] 如何取得 Request URL 的各個部分
from寶哥 http://blog.miniasp.com/post/2008/02/10/How-Do-I-Get-Paths-and-URL-fragments-from-the-HttpRequest-object.aspx
底下這張表就是各種跟 Browser Request 的網址相關的屬性與用法:
| 網址:http://localhost:1897/News/Press/Content.aspx/123?id=1#toc | |
| Request.ApplicationPath | / |
| Request.PhysicalPath | D:\Projects\Solution\web\News\Press\Content.aspx |
| System.IO.Path.GetDirectoryName(Request.PhysicalPath) | D:\Projects\Solution\web\News\Press |
| Request.PhysicalApplicationPath | D:\Projects\Solution\web\ |
| System.IO.Path.GetFileName(Request.PhysicalPath) | Content.aspx |
| Request.CurrentExecutionFilePath | /News/Press/Content.aspx |
| Request.FilePath | /News/Press/Content.aspx |
| Request.Path | /News/Press/Content.aspx/123 |
| Request.RawUrl | /News/Press/Content.aspx/123?id=1 |
| Request.Url.AbsolutePath | /News/Press/Content.aspx/123 |
| Request.Url.AbsoluteUri | http://localhost:1897/News/Press/Content.aspx/123?id=1 |
| Request.Url.Scheme | http |
| Request.Url.Host | localhost |
| Request.Url.Port | 1897 |
| Request.Url.Authority | localhost:1897 |
| Request.Url.LocalPath | /News/Press/Content.aspx/123 |
| Request.PathInfo | /123 |
| Request.Url.PathAndQuery | /News/Press/Content.aspx/123?id=1 |
| Request.Url.Query | ?id=1 |
| Request.Url.Fragment | |
| Request.Url.Segments | / News/ Press/ Content.aspx/ 123 |
[SQL] NOT IN clause and NULL values
Author: Mango
|
at:晚上10:53
|
Category :
SQL
|
from:http://stackoverflow.com/questions/129077/not-in-clause-and-null-values
當下NOT IN時,括號裡面的值含有NULL,就會甚麼都撈不到
因為null不等於任何值
null也不等於null
所以,下NOT IN時,建議將null過濾掉 WHERE *** IS NOT NULL
A: select 'true' where 3 in (1, 2, 3, null)
B: select 'true' where 3 not in (1, 2, null)
Query A is the same as:
select 'true' where 3 = 1 or 3 = 2 or 3 = 3 or 3 = null
Since
3 = 3 is true, you get a result.
Query B is the same as:
select 'true' where 3 <> 1 and 3 <> 2 and 3 <> null
When
ansi_nulls is on, 3 <> null is UNKNOWN, so the predicate evaluates to UNKNOWN, and you don't get any rows.
When
ansi_nulls is off, 3 <> null is true, so the predicate evaluates to true, and you get a row.
zh-CN → zh-TW
,下
2014年7月6日 星期日
[C#] KeyValue 代碼表
from: http://www.cnblogs.com/manongxiaobing/archive/2012/11/05/2755412.html
鍵盤按鍵 - 對應的代碼
| backspace | 8 |
| tab | 9 |
| enter | 13 |
| shift | 16 |
| ctrl | 17 |
| alt | 18 |
| pause/break | 19 |
| caps lock | 20 |
| escape | 27 |
| page up | 33 |
| Space | 32 |
| page down | 34 |
| end | 35 |
| home | 36 |
| arrow left | 37 |
| arrow up | 38 |
| arrow right | 39 |
| arrow down | 40 |
| insert | 45 |
| delete | 46 |
| 0 | 48 |
| 1 | 49 |
| 2 | 50 |
| 3 | 51 |
| 4 | 52 |
| 5 | 53 |
| 6 | 54 |
| 7 | 55 |
| 8 | 56 |
| 9 | 57 |
| a | 65 |
| b | 66 |
| c | 67 |
| d | 68 |
| e | 69 |
| f | 70 |
| g | 71 |
| h | 72 |
| i | 73 |
| j | 74 |
| k | 75 |
| l | 76 |
| m | 77 |
| n | 78 |
| o | 79 |
| p | 80 |
| q | 81 |
| r | 82 |
| s | 83 |
| t | 84 |
| u | 85 |
| v | 86 |
| w | 87 |
| x | 88 |
| y | 89 |
| z | 90 |
| left window key | 91 |
| right window key | 92 |
| select key | 93 |
| numpad 0 | 96 |
| numpad 1 | 97 |
| numpad 2 | 98 |
| numpad 3 | 99 |
| numpad 4 | 100 |
| numpad 5 | 101 |
| numpad 6 | 102 |
| numpad 7 | 103 |
| numpad 8 | 104 |
| numpad 9 | 105 |
| multiply | 106 |
| add | 107 |
| subtract | 109 |
| decimal point | 110 |
| divide | 111 |
| f1 | 112 |
| f2 | 113 |
| f3 | 114 |
| f4 | 115 |
| f5 | 116 |
| f6 | 117 |
| f7 | 118 |
| f8 | 119 |
| f9 | 120 |
| f10 | 121 |
| f1 |
2014年6月26日 星期四
.NET MVC 筆記
MVC筆記
規劃兩個月製作MVC簡報,也告一段落了,紀錄其他延伸閱讀的筆記
ASP.NET MVC使用筆記
http://catchtest.pixnet.net/blog/post/29156132-asp.net-mvc%E4%BD%BF%E7%94%A8%E7%AD%86%E8%A8%98
格式化 Javascript
http://www.css88.com/tool/js_beautify/
ASP.NET MVC專案最佳化
http://blog.kkbruce.net/2013/07/asp-net-mvc-project-performance-security-up-tips.html#.U5_1ZvmSylA
確保傳輸資料的安全
http://ithelp.ithome.com.tw/question/10137427
使用输出缓存提高性能
http://www.360doc.com/content/11/0303/22/6101874_97895851.shtml
ASP.NET性能優化之讓瀏覽器緩存動態網頁
http://rritw.com/a/bianchengyuyan/_NET/20110915/128804.html
黑暗執行序 - ASP.NET MVC路由練習-API分版
http://blog.darkthread.net/post-2013-09-16-aspnet-mvc-versioning-via-routing.aspx
快快樂樂學LINQ系列
http://www.dotblogs.com.tw/hatelove/category/6084.aspx
如何提昇LINQ 的效能!?
http://flashlin.wordpress.com/2009/03/24/%E5%A6%82%E4%BD%95%E6%8F%90%E6%98%87linq-%E7%9A%84%E6%95%88%E8%83%BD/
ADO.Net Entity Framework : (二十) 提升EF執行速度方法
http://www.dotblogs.com.tw/asdtey/archive/2009/10/28/efimproveperformance.aspx?fid=58201
2014年6月23日 星期一
一般View與Partial View有什麼不同呢?
from : http://arthurmvc.blogspot.tw/2012/11/aspnet-mvcview.html
在上一章中,我曾提到過有關Controller的命名會受到限制,所有Controller都必需是Controller這幾個英文字作為結尾,同理可知,想必這裡應該也是在命名原則上作文章,是的!在View中若是以底線作為檔案名稱開頭的View,其意義就是這個View是一種Partial View!
一般View與Partial View有什麼不同呢?
我可以把它想作成:一般View是一個我們預期它為一個既完整又是最終的畫面呈現,而Partial View是畫中的某一部份。有的時候,一個View太過巨大在設計及維護上有著很高的障礙,為了避免太過複雜而讓自己陷入設計的泥淖,通常,會將一個View中的某幾個部份獨立出來成為Partial View。在本文前面所述,在專案的開發過程中,有的時候我們會發現某些頁面會有一個共同的部份,這個時候通常我們也會將其共同的部份切割出來成為一個Partial View並放置在Views/Share資料夾中共用。
2014年6月20日 星期五
[MVC] - ViewBag 裡使用方法(Method)
from: http://kevintsengtw.blogspot.tw/2012/04/aspnet-mvc-3viewbag-method.html#.U6QCbPmSylA
//
// GET: /ViewDataBag/
public ActionResult func()
{
ViewData["func1"] = DateTime.Now;
ViewBag.func1 = new Func<int, string>(GetStr);
return View();
}
private string GetStr(int iNumber)
{
if (iNumber >= 60)
{
return iNumber.ToString() + " 及格";
}
else
{
return iNumber.ToString() + " 不及格";
}
}
//
// GET: /ViewDataBag/
public ActionResult func()
{
ViewData["func1"] = DateTime.Now;
ViewBag.func1 = new Func<int, string>(GetStr);
return View();
}
private string GetStr(int iNumber)
{
if (iNumber >= 60)
{
return iNumber.ToString() + " 及格";
}
else
{
return iNumber.ToString() + " 不及格";
}
}
2014年6月19日 星期四
[MVC] 停止瀏覽器快取網頁 for ASP.NET
From http://jhshen.blogspot.tw/2010/07/for-aspnet-mvc.html
瀏覽器為了加速網頁讀取,通常會採用快取,
所以使用者登出後,按下"回上一頁"幾乎都可以看到登出前瀏覽過的資料。
要避免使用者登出後使用"回上一頁"功能,最簡單的方式就是讓頁面不被快取,
在網路上找了一些方法,都是在<head></head>裡面加上:
//將網頁設為立即過期。
<meta http-equiv="Expires" content="0" />
//舊寫法,為了增加相容性。
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma-directive" content="no-cache" />
<meta http-equiv="Cache-Directive" content="no-cache" />
不過這樣做,不知道為什麼在 IIS 6 的環境上,執行 ASP.NET MVC 的 Web Application 還是可以讓使用者按下"回上一頁"...
後來發現也可以直接加在 http response headers 上,
因此,改寫了一下專案裡面 base Controller 在 Initialize 時,設定 Response 的 cache 設定,設定如下:
protected override void Initialize(RequestContext requestContext)
{
base.Initialize(requestContext);
requestContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
requestContext.HttpContext.Response.Cache.SetExpires(DateTime.MinValue);
requestContext.HttpContext.Response.Cache.SetNoStore();
}
2014年6月17日 星期二
[chrome] network 時間說明
Author: Mango
|
at:下午6:44
|
Category :
chrome
|
from
http://stackoverflow.com/questions/10537399/what-does-the-times-mean-in-google-chromes-timeline-in-the-network-panel
chrome官方文件
https://developer.chrome.com/devtools/docs/network
2014年6月15日 星期日
[MVC] Two Html.ActionLink in a column using WebGrid
form http://forums.asp.net/t/1653111.aspx?Two+Html+ActionLink+in+a+column+using+Webgrid
columns: grid.Columns( grid.Column("id"), grid.Column("Name"), grid.Column(header: "Actions", format: (item) => new HtmlString( Html.ActionLink("Edit", "Edit", new { id = item.id } ).ToString() + Html.ActionLink("Delete", "Delete", new { id = item.id } ) .ToString() ) ) )
訂閱:
文章 (Atom)

