Pages

Friday, December 31, 2010

Server Error ( IIS 7.0)

Question : -Server Error ( IIS 7.0 ) 
Operating System : Windows Server 2008
I get the error shown in the screenshot when I try to create a user account on ASP.NET website.
If possible, please give me the step by step procedure as to what needs to be done.





Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.


Solution: - Please check your connection string, if user setting and DB details are fine. Also check if DB service is running fine. You can see the various types of connection strings here : http://www.connectionstrings.com/
to check the SQL connection string you can see the details in your web.config. And can try to telnet on port 1433 (default SQL port , can be different in your environment ) or you can make a test ODBC connection from Administrative tools. 


****AS IS**** ; Apply at your own risk.

Thursday, December 30, 2010

Idea

Idea :-)

An IDEA can change your Life ... But, a Girl Can change your IDEA

~~~~~~~~^_^~~~~~~~~

Not able to connect the Team Foundation Server 2010

Question : - We are not able to connect the TFS 2010.
System Configuration: IIS 7.0 (Web Server Name:XXXXXX)
Windows Server 2008

---------------------------
Microsoft Visual Studio
---------------------------
TF205020: A connection could not be made to the following server:
XXXXXX\CMMS. This server was used during your most recent session, but it might be offline, or network problems might be preventing the connection. Contact the administrator for Team Foundation Server to confirm that the server is available on the network. To attempt to connect to this server or a different server, open the Team menu, and click Connect to Team Foundation Server.



The server returned the following error: Team Foundation services are not available from server
Please reset the IIS on this box and then try it. XXXXXX\CMMS.

Technical information (for administrator):

  Unable to connect to the remote server


Solution : -
Please reset the IIS on this box and then try it.

Wednesday, December 29, 2010

IIS 7 And FTP sites

Question : - I want to create 200+ FTP sites for different organizations within my company.  I don’t want to create an FTP folder and then create the 200+ folders within this default FTP folder.
I want the users to connect to the different FTP sites with a friendly name: ftp://sales, ftp://finance, etc.  Rather than ftp://sales:2009, ftp://finance:3413, etc.
Possible?  If so, how with as little ‘scripting’ as possible.


Answer : - 
You can create multiple FTp sites using multiple virtual host names: -
http://learn.iis.net/page.aspx/320/using-ftp-virtual-host-names/

# You created a new FTP site named "www.example.com", with the site's content root at "%SystemDrive%\inetpub\www.example.com".
# You bound the FTP site to the local loopback address for your computer on port 21 using "www.example.com" as the virtual host name

Similarly : -
# Create another site with different hostname : "Finance" , different content root
# Create another site with different hostname : "Admin" , different content root

Tuesday, December 21, 2010

IIS LOG Replicator/Sync


IIS LOG replicator/sync

I need to copy my new log files and updated log files from my IIS server to another server every 5 minutes or so. is there built in windows tools that can do this, or free 3rd third party tolls, or a script of some sort that can handle this.  

My Solution : - You need to create a script file script.bat using xcopy command
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true
then you can schedule a task to run that script every 5 minutes.

Eg, XCOPY C:\utils\MyFile D:\Backup\CopyFile

The user you will use to execute the schedule task should have "Write" access on destination folder as well.

 ****AS IS**** ; Please apply at your own risk.

301 redirects in Apache

301 redirects in Apache
Question : - I have just recreated our old .aspx website in wordpess to improve functionality.  we now are going to change hosts, and are worried about loosing our page / search rankings ect in google.
We were told that 301 redirects would do the trick.   Now i have read a little about this, but don't feel confident enough in dealing with apache and server stuff as i am a novice in those types of things.

so our old website address homepage would be www.example.org/Default.aspx  and other pages like  www.example.org/Content/Programs_Services.aspx  would be changed to www.newsite.org  (home page) and www.newsite.org/programs-services  how would i set-up 301 redirects  with different urls


Answer :- Use Apache module (mod_rewrite) ,     You need to edit File: httpd.conf and the code like
Code :
RewriteEngine On
RewriteRule /.* http://www.new-domain.com/ [R]


****AS IS**** ; Please apply at your own risk.

Wednesday, December 15, 2010

Adding Pictures to Survey in Sharepoint

Question : - I am trying to add some pictures to a survery to be rated. I have looked at a couple of solutions on the google but nothing has come up useful. Does any have a solution that will work for Sharepoint 2007?

My solution : - You could add the insert the image  code before the question text, the question should looks like: Ques1:xxxx

Then add JavaScript code  to the newForm.aspx and editForm.aspx
document.getElementById('onetIDListForm').rows[0].cells[0].innerHTML
    =
    document.getElementById('onetIDListForm').rows[0].cells[0].innerHTML.replace(/<').replace(/>/g,'>');


It will work on DispForm, NewForm and EditForm pages. While for 'Summary page" , please use below code
document.getElementById('MSOZoneCell_WebPartWPQ2').innerHTML
    =
    document.getElementById('MSOZoneCell_WebPartWPQ2').innerHTML.replace(/<').replace(/>/g,'>');

Friday, December 10, 2010

IIS is not showing Static files like Images and CSS

To more efficiently use available bandwidth, enable IIS HTTP compression. HTTP compression provides faster transmission time between compression-enabled browsers and IIS, regardless of whether your content is served from local storage or a UNC resource. You can compress static files and application response files. Compressing application response files is usually called dynamic compression.

Operating System : Windows 2003

Procedures

To enable global HTTP compression by using IIS Manager

1.In IIS Manager, double-click the local computer, right-click the Web Sites folder, and then click Properties.
2.Click theService tab, and in the HTTP compression section, select the Compress application files check box to enable compression for dynamic files.
3.Select the Compress static files check box to enable compression for static files.
4.In the Temporary directory box, type the path to a local directory or click Browse to locate a directory. Once a static file is compressed, it is cached in this temporary directory until it expires, or the content changes. The directory must be on the local drive of an NTFS–formatted partition. The directory cannot be compressed or shared, and the access control lists (ACLs) for the directory must include Full Control access to the identity of the application pool or to the IIS_WPG group.
5.Under Maximum temporary directory size, click a folder size option. If you specify a maximum size under Limited to (in megabytes) (the default setting is 95 MB), then when the limit is reached, IIS automatically cleans up the temporary directory by applying the "least recently used" rule.
6.Click Apply, and then click OK.


To enable global HTTP compression by using Adsutil.vbs

1.Open a command prompt.
2.To enable dynamic compression, type the following at the command prompt and then press ENTER:
cscript adsutil.vbs set w3svc/filters/compression/parameters/HcDoDynamicCompression true
3.To enable static compression, type the following at the command prompt and then press ENTER:
cscript adsutil.vbs set w3svc/filters/compression/parameters/HcDoStaticCompression true


****AS IS**** ;  Please apply at your own risk.

Thursday, December 9, 2010

Configure RSS and Sitemap Handler Extensions in IIS

 Configure RSS and Sitemap Handler Extensions in IIS

Operating System : - Windows 2003 

You may face problem while making a RSS server on IIS, its very easy infact. If you are running IIS 6 or lesser then Steps are : - 
  • Launch IIS
  • Go to website , Properties 
  • Home Directory Tab , Configuration
  • On the Mappings tab, click Add. 
  • Map to "Aspnet_isapi.dll" file corresponding your framework
  • Provide Extension name ".rss' , All Verbs and 'Script Engine' option selected
  • Apply , Ok , Ok
  • Also add a MIME TYPE for .RSS , application/rss+xml  

***AS IS**** ; please apply at your own Risk.


Wednesday, December 8, 2010

IIS 7 Permissions issue

We are using w2k8 for our internal Intranet server.  We want to restrict some of the subfolders to specific a domain group.

We have Windows authentication enabled (anonymous is disabled).  The NTFS permissions on the folder are set as follows:
 - WebAdmins = Full Control
 - RegistrationStaff = Read & executie, List folder contents, Read

WebAdmin users and RegistrationStaff users are given a "500 error". If I add "Domain Users" or IIS_IUSRS to the folder, then EVERYONE can access it!

So - how do I limit to just one domain group??

Solution : -
Please see if this helps you : http://technet.microsoft.com/en-us/library/cc753695%28WS.10%29.aspx

How to Register HTTP handler with ASP.NET

To register your HTTP handler with ASP.NET. To do so add an entry in your Web.config at /configuration/system.web/httphandlers.


Please remove all "..." from the below code

...
<.... httpHandlers ....>
    <... clear /   ...>
    <.... add verb="*" path="*" type="namespace.classname, assemblyname" / .....>
<.... /httpHandlers ....>
...


In IIS  , Website  ->> properties -> Configuration -> mapping -> Add -> The Add/Edit Application Extension Mapping dialog box is displayed ->  in Executable box -> type 'Aspnet_isapi.dll'
In Extension box -> type file-name extension like '.sample'
Select the Verify that file exists check box
-> Ok -> apply -> Ok

**Default location of 'Aspnet_isapi.dll'  is %windows%\Microsoft.NET\Framework\version\"


****AS IS**** ; Please apply at your own risk.

Tuesday, December 7, 2010

Lync 2010 Installation Problem

Question:

I'm having a strange problem when installing Lync 2010 on a new server build. I get through all the prerequisite steps and topology publishing just fine. I then move to the "Install or Update Lync Server System" section. From here Step 1, 2, and 3 all complete successfully with no errors.

I run Step 4 and the Lync services sort of start -
Lync Server Audio Test Service: Started
Lync Server File Transfer Agent: Started
Lync Server Front-End: Not Started
Lync Server IM Conferencing: Started
Lync Sever Master Replicator Agent: Started
Lync Server Replicator Agent: Started

When I try to start the Front End service: Windows could not start the Lync Server Front-End on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, please contact the service vendor, and refer to service-specific error code -1008124830.

The event viewer shows this: Log Name:      Lync Server
Source:        LS Server
Date:          12/7/2010 9:08:03 AM
Event ID:      12303
Task Category: (1000)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:     subdomain.gotovelocity.com
Description:
The protocol stack reported a critical error: code C3E93C62 (Configuration failure prevented the server from starting up). The service has to stop.
Event Xml:
http://schemas.microsoft.com/win/2004/08/events/event">
 
   
    12303EventID>
    2
    1000
    0x80000000000000>
   
    149ecordID>
    Lync Server
    subdomain.gotovelocity.com>
   
 

 
    C3E93C62
    Configuration failure prevented the server from starting up
 


Error #2
A component could not be started.  The service has to stop.

Component: Live Communications Applications Module  Error code: C3F2765F!_HRX! (APIEM_E_ESBASE_MISSING!_HRM!)
 
My Solution : -  Try to restart Front End Service, If it works then your problem will be resolved. Otherwise it may lead to rebuild of server.

Detect remote sql user

 Issue : - I have a couple of remaining very legacy database servers who flash their sql ports to the outside world. They contain about 100 databases between them and are all legacy customers so it's a tough sell to contact these customers.

Many, e.g. 10-15 or so have datafeeds or otherwise use this direct database access. I want to identify who these users are so I can contact them, get their ip details, then lock SQL access to the servers correctly.

How can I capture the unique external IPs and their database destinations in MS SQL 2000 to this end, e.g. over a period of a month?


My Solution : - To set up a SQL Profiler trace that tracks users who have logged in or out of the server, do the following:

   1. Create a trace, selecting Audit Login Event.

   2. To return the appropriate information, specify the following data columns:

      EventClass (selected by default)

      EventSubClass

      LoginSID

      LoginName

    * Monitor Transact-SQL activity per user.

      You can create a trace that captures events relating to the Sessions event class, ExistingConnection, and TSQL event classes. Include all data columns in the trace, do not specify any event criteria, and group the captured events by DBUserName.



****AS IS**** ; Please apply at your own risk. 

Setting up PHP to work on Windows Server 2003

Operating System : - Windows Server 2003
Automatic PHP installation using php-5.2.13-win32-installer.msi to C:\PHP\ and system has default set of permissions

Automatic Installation of 'php-5.2.13-win32" using IIS ISAPI Module option 
This automatic installation will not configure any Web Service extension and Application extension.
So we need to create a Application extension
Extn : - .php , Path : - C:\PHP\php5isapi.dll  , Verbs ; - All Verbs ,  Script Engine checked.
And also create  a Web Service Extension
Extension Name : PHP , File Path : - C:\PHP\php5isapi.dll

Automatic Installation of "php-5.2.13-win32" using IIS CGI Module option 
This automatic installation won't configure any application extension and web service extension
Create a Application extension
Extn name : - .php, File Path: -  C:\PHP\php-cgi.exe , Verbs : - All Verbs , Script Engine checked.
And also create  a Web Service Extension
Extn name : - PHP , File Path: -  C:\PHP\php-cgi.exe


****AS IS**** ; Please apply at your own risk.

Setting up PHP to work on Windows Server 2003

Setting up PHP to work on Windows Server 2003

Operating System : - Windows Server 2003
PHP version used in this test : php-5.2.8-Win32 Manual Installation
 
You have unzipped PHP (http://www.php.net) to C:\PHP and also You are using default (unmodified) ACLs/Permissions
Administrative tools in the Control Panel by clicking Start -> Administrative Tools -> IIS Manager
"Web Service Extensions" -> "Add a new Web service extension" - > Provide extension name "PHP" in and for the required files put "C:\PHP\php.exe" 
set it to allowed
Now on the corresponding website  add the .php extension to the file "C:\PHP\php5isapi.dll" and allow it.

PHP sample Test page: In the website create a php test page Test.php and write a code in it:

phpinfo();
?>

Save the file and browse it to confirm php is working fine. 

 PHP version used in this test : php-5.2.8-Win32 Automatic Installation using FastCGI Module option
 You have installed PHP (http://www.php.net) to C:\PHP and also You are using default (unmodified) ACLs/Permissions.
It will automatically create a Website Application Extension : -
.php - "C:\php\php-cgi.exe" , Verbs (All) , Script engine Checked

Also it will automatically create a WEb Service Extension : - 
PHP  - C:\PHP\php-cgi.exe with status Allowed




PHP version used in this test : php-5.2.8-Win32 Automatic Installation using IIS ISAPI Module
You have installed PHP (http://www.php.net) to C:\PHP and also You are using default (unmodified) ACLs/Permissions
This installation will automatically create Web Service extension : - 
PHP (C:\PHP\php5isapi.dll) with status Allowed. 
And a Website Application extension  : -
.php - C:\PHP\php5isapi.dll , Verbs (All) , Script engine Checked

****AS IS**** ; Please apply at your own risk. 

Friday, December 3, 2010

Create website using iisweb script

A small script crafted for the creation of multiple websites on IIS 6.0, This Syntax describes the switches: 





Applied to Operating System : - Windows 2003 Server

iisweb /createPathSiteName [/bPort] [/iIPAddress] [/dHostHeader] [/dontstart] [/sComputer [/u [Domain\]User/pPassword]]
 
/sComputer switch  can be used incase you want to create the website on a remote IIS webserver.

Running Example : -
iisweb /create c:\Expert\website Expert /b 80 /d "Expert.com" /dontstart
iisweb /create c:\Expert\ASP ExpertASP /b 80 /d "ExpertASP" /dontstart
iisweb /create c:\Expert\html Experthtml /b 80 /i 120.12.14.167  /d "ExpertASP" /dontstart

****AS IS**** ; Apply at your own risk.

Thursday, December 2, 2010

Check what are the set of Permissions required for the Application pool identity


NTFS permissions
Directory
Users\Groups
Permissions
%windir%\help\iishelp\common
IIS_WPG
Read, execute
%windir%\IIS Temporary Compressed Files
IIS_WPG
Full control
%windir%\system32\inetsrv\ASP compiled templates
IIS_WPG
Full control
Inetpub\wwwroot (or content directories)
IIS_WPG
Read, execute

Registry permissions
Location
Users\Groups
Permissions
HKLM\System\CurrentControlSet\Services\ASP
IIS_WPG
Read
HKLM\System\CurrentControlSet\Services\HTTP
IIS_WPG
Read
HKLM\System\CurrentControlSet\Services\IISAdmin
IIS_WPG
Read
HKLM\System\CurrentControlSet\Services\w3svc
IIS_WPG
Read

Windows user rights
Policy
Users
Access this computer from the network
ASPNET
Access this computer from the network
IWAM_MachineName
Adjust memory quotas for a process
IWAM_MachineName
Adjust memory quotas for a process
Network service
Bypass traverse checking
IIS_WPG
Deny logon locally
ASPNET
Impersonate a client after authentication
ASPNET
Impersonate a client after authentication
IIS_WPG
Log on as a batch job
ASPNET
Log on as a batch job
IIS_WPG
Log on as a batch job
IWAM_MachineName
Logon as a service
ASPNET
Logon as a service
Network service
Replace a process level token
IWAM_MachineName
Replace a process level token
Network service

Webpage redirect without change of hostname URL Address

Please create a /Test folder under your website and create two pages there , Default.asp and redirect.asp

Please add  <  >  before all of the tags like html,head, title , body and iframe.
html head  title Home Page /title
/head body iframe
src="redirect.asp" width="100%" height="100%">
/iframe /body /html

And content of redirect.asp is :
Redirect Page
html head "Redirect Page" /head
body  <% response.redirect( http: // www.google.com) %>
/body
/html

 ****AS IS**** ; Please apply at your own risk.

Asp.Net Permissions

We are using System.IO.FileSystemInfo to read the contents of a share on a server in an ASP.Net page.

When the page opens it gives this error:
Access not possible, error: System.UnauthorizedAccessException: Access to the path '//server/f/intranet/' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileSystemInfo.get_CreationTimeUtc() at System.IO.FileSystemInfo.get_CreationTime() at ASP.listdir_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer)


The ASP.net "user" needs to be given access to the network share.  If you are running Windows 2003 this is the "NETWORK SERVICE", if you are running Windows 2000 it is "ASPNET". You may need to create a new user specifically for this and set up asp.net identity impersonation.

****AS IS**** ; Please apply at your own risk. 

How to backup Active Directory for recovery on Windows Server 2008

How to backup Active Directory for recovery on Windows Server 2008

Operating system : - Windows Server 2008 

You need need to maintain a good backup for system state of your active directory, First make a System State backup on a Domain Controller and maintain those backups by removing the old ones from the backup catalog.

Requirement:

1.       A secondary hard disk on domain controller attached locally to it. A network drive won't work.
2.       Install the Windows server backup (Backup tool is not installed by default)

To  Install it:

1.       Open Window Server manager snap-in
2.        Access features section and click on Add a New feature
3.       Select Windows Server backup  including the “Command Line tools”, This will also require PowerShell
4.       Click on Install button.

Scheduling the System State Backup

If you check the GUI of the Windows SerVer Backup, You will find there is no method available to backup the System state. The only possible way to backup the System state using this tool is using the command line.  Now to run  the backup as schedule task we need to make a script file (.bat) will schedule it.

Here we go

1.       In Notepad or any other  text editor
@echo off
### “off” will not display processing on the screen
WBADMIN START SYSTEMSTATEBACKUP –backuptarget:d: -quiet
###”d: ” is your  drive where backup of catalog will be saved
###”-quiet”: is the parameter used to not to ask for any confirmation

2.       Save it as a batch file naming “PCS-SysStateBKP.bat” and save it to D: drive

3.       Run -> Tasks -> New Task -> On General tab
a.       Run whether the user is logged or not
b.       Run with the highest privileges

4.       Triggers Tab , click ‘New’ define schedule you want
5.       On Actions click on the “New” and select a Start a program, map it to d:\ “PCS-SysStateBKP.bat”
6.       Ok, Run


This schedule task will take 1 hr approximately.  Till the time Task will show “This process is running”. Please make sure your D:\ drive have enough free space as equal to your ‘System’ drive which is commonly C drive. This automatic backup will save the file as .bkf which you can’t view.

We can write a new schedule task that will keep every week only the newer backups:
WBADMIN DELETE SYSTEMSTATEBACKUP – BACKUPTARGET:e: -deleteOldest –quiet

Save this command in notepad as D:\“pcs-OldStateDel.bat”
Now schedule it as a task to run weekly. You may like to run this schedule task before the backup task.

Restore AD:
http://technet.microsoft.com/en-us/library/cc732714(WS.10).aspx


****AS IS**** ; Please apply at your own risk.

Active Directory is the only Global Catalog ?

How do I check whether the Primary AD is the only Global Catalog?

Run below command on any of dc with support tool installed or manually download dsquery.exe tool to check which dc's are acting as GC

dsquery server -isgc