Monday, April 11, 2011
SOLID
SOLID but for those who don’t know, it stands for Single Responsibility, Open/Closed Principle, Liskov substitution, Interface Segregation and Dependency Inversion, introduced by Robert C. Martin, which is basically a collection of principles that one should keep in mind while creating a system that’s easy to maintain and extend over time
The file is not part of the project or its Build Action property is not set to Resource
I wanted to play .wmv file in my website using the Silverlight Media Element. Here is the Syntax
<mediaelement name="media" source="Test.wmv" width="300" height="300">
But I was getting the error. "The file is not part of the project or its Build Action property is not set to 'Resource'.
I modified the Source attribute of the Media Element as shown below and it worked.
<mediaelement name="media" source="/[SolutionName];component/Test.wmv" width="300" height="300">
<mediaelement name="media" source="Test.wmv" width="300" height="300">
But I was getting the error. "The file is not part of the project or its Build Action property is not set to 'Resource'.
I modified the Source attribute of the Media Element as shown below and it worked.
<mediaelement name="media" source="/[SolutionName];component/Test.wmv" width="300" height="300">
Wednesday, May 19, 2010
Visual Studio Color Schemes
Came across this nice website. It talks about the Visual Studio color schemes.
Visual Studio allows us to completely customize the editor background and text colors to whatever we want. Here is the link.
http://weblogs.asp.net/scottgu/archive/2010/04/29/download-and-share-visual-studio-color-schemes.aspx
Visual Studio allows us to completely customize the editor background and text colors to whatever we want. Here is the link.
http://weblogs.asp.net/scottgu/archive/2010/04/29/download-and-share-visual-studio-color-schemes.aspx
Friday, April 16, 2010
Monitoring the File System
Today one of my friend asked about retrieving the Time stamp value in C# whenever a file is Renamed. I was not sure as how to achieve this. As far as I know System.IO doesn't expose any property to retrieve the time stamp value whenever a file is renamed. We can use the System.IO.FileSystemWatcher class to monitor the file system.
Wednesday, March 10, 2010
The worker process failed to initialize the http.sys communication or the w3svc communication layer and therefore could not be started.
The worker process failed to initialize the http.sys communication or the w3svc communication layer and therefore could not be started. The data field contains the error number.
On one of the customer’s server we got this error while navigating to a website. Ours is a WebClient application and we use the ClickOnce technology to publish our files to the Server.
Recently there was an upgrade happened on that system. The system was running Windows 2003 Server with Service Pack 2. It was to be upgraded to Windows Server 2003 Enterprise Edition. Unfortunately, the upgrade was not successful and in the process the registry got overwritten. IIS too get corrupted. The website was running IIS 6.
IIS 6 has Application Pool; an Application Pool can contain one or more applications and allows us to configure a level of isolation between different Web applications. Each application Pool has its own Identity. Usually, it runs with the Network Service credentials.
The Problem:
Whenever we tried opening a web site we were getting the “Service Not Available” screen. The reason was the application pool would automatically get stopped. Event Viewer was displaying the above error. Please refer to the article below for further reference.
http://support.microsoft.com/kb/896286
Troubleshoot:
We tried the above steps mentioned in the article but unfortunately it didn’t worked out. We also referred to the below link which mentioned about an issue with one of the service pack 2 updates. Please refer the article below.
http://www.pmcdonnell.ie/?p=42
None of the above resolution helped us in resolving this issue.
Following are the steps that resolved the issue.
1. Uninstall IIS
2. Re-Install IIS
3. Run the below command. If IIS is installed after .Net then we need to register the asp.net. Open the VS command prompt or go to c:\[windows/winnt]\[Microsoft.Net]\[Framwowrk]\[ v2.0.50727]\aspnet_regiis.exe –i.
4. Create the virtual directory.
5. Create the Application Pool.
6. Assign the application pool to the virtual directory.
7. Run the website.
On one of the customer’s server we got this error while navigating to a website. Ours is a WebClient application and we use the ClickOnce technology to publish our files to the Server.
Recently there was an upgrade happened on that system. The system was running Windows 2003 Server with Service Pack 2. It was to be upgraded to Windows Server 2003 Enterprise Edition. Unfortunately, the upgrade was not successful and in the process the registry got overwritten. IIS too get corrupted. The website was running IIS 6.
IIS 6 has Application Pool; an Application Pool can contain one or more applications and allows us to configure a level of isolation between different Web applications. Each application Pool has its own Identity. Usually, it runs with the Network Service credentials.
The Problem:
Whenever we tried opening a web site we were getting the “Service Not Available” screen. The reason was the application pool would automatically get stopped. Event Viewer was displaying the above error. Please refer to the article below for further reference.
http://support.microsoft.com/kb/896286
Troubleshoot:
We tried the above steps mentioned in the article but unfortunately it didn’t worked out. We also referred to the below link which mentioned about an issue with one of the service pack 2 updates. Please refer the article below.
http://www.pmcdonnell.ie/?p=42
None of the above resolution helped us in resolving this issue.
Following are the steps that resolved the issue.
1. Uninstall IIS
2. Re-Install IIS
3. Run the below command. If IIS is installed after .Net then we need to register the asp.net. Open the VS command prompt or go to c:\[windows/winnt]\[Microsoft.Net]\[Framwowrk]\[ v2.0.50727]\aspnet_regiis.exe –i.
4. Create the virtual directory.
5. Create the Application Pool.
6. Assign the application pool to the virtual directory.
7. Run the website.
Monday, October 26, 2009
DataReader and Dataset
In one of the project that I was working on there was a Time Out exception happened while navigating through lot of records. It was causing the whole application to crash. While examinig the application closely and running the sql profiler and using the below query to get all the processes that are active or getting created.
Query Analyzer:
EXEC SP_WHO2
SELECT [sql_handle],stmt_start,stmt_end,loginame,[program_name],hostname,* FROM MASTER..SYSPROCESSES WHERE [program_name]='.Net SqlClient Data Provider' ORDER BY SPID DESC
SELECT * FROM MASTER..SYSDATABASES
SYSDATABASES will give the database name that is being used.
SQL Profiler:
In the Sql profiler we can examine for which database and for what processes the queries are executed.
***********************************************************************************
While closely examining the code I found out that the datareader was cauing the issue. And also I noticed that the sp_reset_connection Stored procedure was not getting called after the datareader performed its operation.
Changing this to dataset really resolved the issue and unnecessary connection was not getting opened and also sp_reset_connection was getting called.
Query Analyzer:
EXEC SP_WHO2
SELECT [sql_handle],stmt_start,stmt_end,loginame,[program_name],hostname,* FROM MASTER..SYSPROCESSES WHERE [program_name]='.Net SqlClient Data Provider' ORDER BY SPID DESC
SELECT * FROM MASTER..SYSDATABASES
SYSDATABASES will give the database name that is being used.
SQL Profiler:
In the Sql profiler we can examine for which database and for what processes the queries are executed.
***********************************************************************************
While closely examining the code I found out that the datareader was cauing the issue. And also I noticed that the sp_reset_connection Stored procedure was not getting called after the datareader performed its operation.
Changing this to dataset really resolved the issue and unnecessary connection was not getting opened and also sp_reset_connection was getting called.
Sunday, October 25, 2009
Bin Scope Binary Analyzer: Mini Fuzz Tool
Bin Scope Binary Analyzer:
The BinScope Binary Analyzer is a Microsoft verification tool that analyzes binaries to ensure that they have been built in compliance with Microsoft’s Security Development Lifecycle (SDL) requirements and recommendations. BinScope checks that SDL-required compiler/linker flags are being set, strong-named assemblies are in use, and up-to-date build tools are in place. BinScope also reports on dangerous constructs that are prohibited or discouraged by the SDL (e.g. read/write shared sections and global function pointers).
This below article has a small demonstration video.
http://blogs.technet.com/security/
It can be run standalone or integrated with the VS IDE.
Download:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=90e6181c-5905-4799-826a-772eafd4440a
Mini File Fuzzer:
A testing technique that can help find denial of service and security vulnerabilities in software.
Technique:
1. Force application to malformed data.
2. If crash occurs, identify where and how.
3. File a security bug.
4. Investigate underlying code for security risk.
This below article has a small demonstration video.
http://blogs.technet.com/security/
Download
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=b2307ca4-638f-4641-9946-dc0a5abe8513
The BinScope Binary Analyzer is a Microsoft verification tool that analyzes binaries to ensure that they have been built in compliance with Microsoft’s Security Development Lifecycle (SDL) requirements and recommendations. BinScope checks that SDL-required compiler/linker flags are being set, strong-named assemblies are in use, and up-to-date build tools are in place. BinScope also reports on dangerous constructs that are prohibited or discouraged by the SDL (e.g. read/write shared sections and global function pointers).
This below article has a small demonstration video.
http://blogs.technet.com/security/
It can be run standalone or integrated with the VS IDE.
Download:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=90e6181c-5905-4799-826a-772eafd4440a
Mini File Fuzzer:
A testing technique that can help find denial of service and security vulnerabilities in software.
Technique:
1. Force application to malformed data.
2. If crash occurs, identify where and how.
3. File a security bug.
4. Investigate underlying code for security risk.
This below article has a small demonstration video.
http://blogs.technet.com/security/
Download
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=b2307ca4-638f-4641-9946-dc0a5abe8513
Subscribe to:
Posts (Atom)