[IIS7] log entries for a specific web site

 

  1. Click on the Web Site (Default Web Site) > Right click and hover to Manage Web Site, click on Advanced Settings > Find ID

    ID = 1
  2. Click on the Web Site (Default Web Site) > Features View double click on Logging icon > Find Directory 

Directory = %SystemDrive%\inetpub\logs\LogFiles

The file path must be under the

%SystemDrive%\inetpub\logs\LogFiles\W3SVC1

[Firebug] Small font size on command line

 

Encounter environment : Windows 7 + Firefox (5.0.1 ~ 7.0.1) + Firebug (old version ~ 1.9a5)

Encounter panel on Firebug: HTML & Console

Screenshot :

2011-08-01_2143

Not work on choose different font size : Firebug > Menu > Text Size > Increase Text size

Solution : Tools > Options > Change default font is works.

[Umbraco] Item has already been added. Key in dictionary: '??' Key being added: '??'

Error description:

Server Error in '/' Application.


Item has already been added. Key in dictionary: '??'  Key being added: '??'

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Item has already been added. Key in dictionary: '??'  Key being added: '??'
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

DB Log:

At /umbraco/editContent.aspx?id=???? (Referred by: http://localhost/umbraco/umbraco.aspx): System.ArgumentException: Item has already been added. Key in dictionary: '??'  Key being added: '82'     at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)     at umbraco.controls.ContentControl.CreateChildControls()     at System.Web.UI.Control.EnsureChildControls()     at umbraco.controls.ContentControl.OnInit(EventArgs e)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Control.AddedControl(Control control, Int32 index)     at umbraco.cms.presentation.editContent.OnInit(EventArgs e)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

How to reproduce the problem in my environments.(NOT 100%) : 

1. Create a document type with multiple tabs and inherited other tabs from parents document type.

2. Create a node and get {nodeId}.

3. Open edit page URL http://localhost/umbraco/editContent.aspx?id={nodeId}. on multiple browser (Here I used three difference browsers in the same time. )

3. Run command iisreset

4. Repeated step 2 & 3.

 

Temporary Solution:

1. Recycle Application pool.

2.Type:http://localhost/umbraco/cacheBrowser.aspx?clearByType=umbraco.cms.businesslogic.ContentType

 

Update : 2014.04.23

This is Umbraco bug will affected versions 4.7.0 & 4.8.0 , already fixed in changeset 18d853003c17 in 4.9.0 , the root cause is :
// This class can be cached and potentially shared between multiple threads.
// Two or more threads can attempt to lazyily-load its virtual tabs at the same time.
// If that happens, the m_VirtualTabs will contain duplicates.
// We must prevent two threads from running InitializeVirtualTabs at the same time.
// We must also prevent m_VirtualTabs from being modified while it is being populated.
// optimize, lazy load the data only one time

The issue may occur on every 30 min once the ContentType Cache refresh.

Permanent Solution:

  1. Update source code at /src/umbraco.cms/businesslogic/ContentType.cs , and rebuild source code to get businesslogic.dll
    http://umbraco.codeplex.com/SourceControl/changeset/18d853003c17#src/umbraco.cms/businesslogic/ContentType.cs
  2. Upgrade Umbraco version to v4.9.0

 

More Information :

The "GenerateResource" task failed unexpectedly.

Error description:

The "GenerateResource" task failed unexpectedly.
System.TypeInitializationException: The type initializer for 'Microsoft.Build.Utilities.FileTracker' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Build.Utilities.FileTracker..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.Build.Utilities.FileTracker.ForceOutOfProcTracking(ExecutableType toolType, String dllName, String cancelEventName)
   at Microsoft.Build.Tasks.GenerateResource.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)    umbraco.presentation

 

Solution:

Refers to Microsoft.NET Framework v4.0.30319
Go to directory C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(Preferably -Open the file with Notepad)
Search for <PropertyGroup> , and then set <TrackFileAccess> to false

Reference: http://connect.microsoft.com/VisualStudio/feedback/details/501894/the-generateresource-task-failed-unexpectedly-system-dllnotfoundexception-unable-to-load-dll-filetracker-dll-the-specified-module-could-not-be-found-exception-from-hresult-0x8007007e

.NET Generic Handler(ashx) Object to JSON Serialization


public class jsonSample : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";

Person p = new Person();
p.name = "Richard";
p.address.Add("Taipei");
p.address.Add("US");

// .NET 3.5 & 4 solution
// Reference : http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx
System.Web.Script.Serialization.JavaScriptSerializer serializer =
new System.Web.Script.Serialization.JavaScriptSerializer();
context.Response.Write(serializer.Serialize(p));

// Json.NET solution
// Reference : http://json.codeplex.com/
context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(p));

/* Result:
*
* {"name":"Richard","address":["Taipei","US"]}
*
*/
}

public bool IsReusable
{
get
{
return false;
}
}
}

public class Person
{
public List<string> address = new List<string>();
public string name;
}

Speed up SQL Server Management Studio (SSMS)

 

[Solution] : Add an entry in your HOSTS

  1. Press the keys [Win] + [R]
  2. notepad %systemroot%\system32\drivers\etc\hosts.
  3. Append the following..
    127.0.0.1    crl.microsoft.com
  4. Save the file.

ref: http://www.virtualobjectives.com.au/sqlserver/ssms_slow.htm

[Solution] : Use sqlwb Utility –nosplash arguments


ex:

  • ssms.exe –nosplash
  • ssms.exe -nosplash -S "."
  • ssms.exe -nosplash -S ".\SQLEXPRESS"

ref: http://msdn.microsoft.com/en-us/library/ms162825%28v=sql.90%29.aspx

[Solution] : Uncheck “Check publisher’s certificate revocation”

  1. Go into IE, select Tools|Internet Options|Advanced
  2. If “Check publisher's certificate revocation” under the security node is checked, then uncheck it.

ref: http://blogs.msdn.com/b/euanga/archive/2006/07/11/662053.aspx

.NET C# byte[] to String sample

Sample array & string

byte[] array = new byte[] { 0x48, 0x65, 0x6C, 0x6C, 0x6F, 
0x57, 0x6F, 0x72, 0x6C, 0x64 }; //"HelloWorld"

byte[] to String

string str = System.Text.Encoding.Default.GetString(array);
string str = System.Text.Encoding.ASCII.GetString(array);

byte[] to String

System.Text.ASCIIEncoding converter = new System.Text.ASCIIEncoding();
string str = converter.GetString(array);

HexString to byte[]

string str = ByteArrayToHex(array);
public static string ByteArrayToHex(byte[] array)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (byte element in array)
sb.Append(element.ToString("X2"));
return sb.ToString();
}

.NET C# String to byte[] sample

Sample array & string

byte[] array = new byte[] { 0x48, 0x65, 0x6C, 0x6C, 0x6F, 
0x57, 0x6F, 0x72, 0x6C, 0x64 }; //"HelloWorld"

String to byte[]

byte[] array= System.Text.Encoding.Default.GetBytes("HelloWorld");
byte[] array= System.Text.Encoding.ASCII.GetBytes("HelloWorld");

String to byte[]

System.Text.ASCIIEncoding converter = new System.Text.ASCIIEncoding();
byte[] array = converter.GetBytes("HelloWorld");

HexString to byte[]

byte[] array = HexToByteArray("48656C6C6F56F726C64");
private static byte[] HexToByteArray(string hexString)
{
byte[] returnBytes = new byte[hexString.Length / 2];
for (int i = 0; i < returnBytes.Length; i++)
returnBytes[i] = System.Convert.ToByte(hexString.Substring(i * 2, 2), 16);
return returnBytes;
}

HexString to byte

byte element = HexToByte("48");
private static byte HexToByte(string hexString)
{
if (hexString.Length > 2 || hexString.Length <= 0)
throw new System.ArgumentException("hex must be 1 or 2 characters in length");
byte newByte = byte.Parse(hexString, System.Globalization.NumberStyles.HexNumber);
return newByte;
}

Console array Result

foreach (byte element in array)
{
System.Console.WriteLine("{0}\t{1}\t{2} ",
(char)element, element, element.ToString("X2"));

}
/*
H 72 48
e 101 65
l 108 6C
l 108 6C
o 111 6F
W 87 57
o 111 6F
r 114 72
l 108 6C
d 100 64
*/