The Temple of Fu

code, systems and games

Archive for the ‘IIS’ Category

IIS 7 – Change Port for Default Web Site

leave a comment »

I installed Team Foundation Server (TFS) 2012 yesterday to do some integration testing for a client. I installed it on my 2008 R2 Windows Server which runs IIS 7.5.

When you install TFS it also installs SharePoint, SharePoint happily installed itself and took over port 80 on my server. Now I did go for a very straightforward wizard installation so there may have been a way to instruct the installer to not use port 80.

The quickest way for me to do what I want to do is simply assign a new port to Default you will also need to remove Default from listening on port 80. I decided I wanted to have Default listen on port 81.

  1. Open IIS Manager
  2. Select Default Web Site
  3. Right Click
  4. Select Edit Bindings
  5. Remove Entry for http 80 binding
  6. Add New Entry for http 81 binding
  7. Restart/Start Default Web Site

Capture

Done, hope this helps.

Advertisements

Written by lordfu

September 22, 2013 at 11:34 am

Move IIS Data Directory script

leave a comment »

I can’t remember how I got this script or from where but I have used it twice now so I am posting it here for others. If you are the original script author please let me know and i would be glad to tag it as such!

'------------------------------------------------------- '
' FILE: moveIISDataDirectory.vbs
' Used to migrate Web Data (FTP, WWW, SMTP) from drive C:\INETPUB to drive D:\INETPUB.
' This script can be modified to meet the need of any customers.
' Please do not remove this header info though.
'--------------------------------------------------------

'Stop IIS services before continuing

Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Stopping all Internet Services..."
ret = WshShell.Run ("net stop iisadmin /y", 1, TRUE)

If ret = 0 then
WSHShell.PopUp "IISADMIN service was stopped successfully, continuing"
'restart()
else
WSHShell.PopUp "IISADMIN failed to stop successfully. The error code is " & ret Wscript.Quit 1
end if

' Modify IIS Metabase Properties for new data location
Dim params(7)
Dim x, ret
Dim params2(3) Params(0) = "w3svc/1/root/path d:\inetpub\wwwroot"
Params(1) = "w3svc/1/root/scripts/path d:\inetpub\scripts "
Params(2) = "w3svc/1/root/iissamples/path d:\inetpub\iissamples"
Params(3) = "msftpsvc/1/root/path d:\inetpub\ftproot"
Params(4) = "smtpsvc/1/BadMailDirectory d:\inetpub\mailroot\BadMail"
Params(5) = "smtpsvc/1/PickupDirectory d:\inetpub\mailroot\Pickup"
Params(6) = "smtpsvc/1/QueueDirectory d:\inetpub\mailroot\Queue"
Params(7) = "smtpsvc/1/DropDirectory d:\inetpub\mailroot\Drop"

Set WshSysEnv = WshShell.Environment("PROCESS")

For Each x In Params
ret = WSHShell.Run ("cscript.exe " & "c:\inetpub\adminscripts\adsutil.vbs SET " & x, 1, TRUE)
Next

' Verify Settings were successfully applied
If ret = 0 then
WSHShell.PopUp "The new metabase settings have been successfully updated. The new Web Data path is D:\inetpub"
else
WSHShell.PopUp "The Configuration changes failed. The error code is " & ret Wscript.Quit 1
end if

wscript.Sleep 5000

' Move Data to new location (D:\inetpub) using xcopy.exe (this can be changed from xcopy to move so the data is actually moved from current locale)
ret = WSHShell.Run ("xcopy c:\inetpub d:\inetpub\ /s /e /q" , 1, TRUE)

If ret = 0 then
WSHShell.PopUp "The data has been successfully moved to d:\inetpub"
else
WSHShell.PopUp "The data move failed. The error code is " & ret Wscript.Quit 1
end if

' Update Web Catalog to be for d:\inetpub 'Stop Content Index Service
Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Stopping Index Service..."
ret = WshShell.Run ("net stop cisvc", 1, TRUE)

If ret = 0 then
chgeCat()
else
WSHShell.PopUp "Content Index service failed to stop successfully. The error code is " & ret Wscript.Quit 1
end if

Function chgeCat()
Set WshShell = WScript.CreateObject("WScript.Shell")

'Delete Catalogs '
WshShell.RegDelete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\"

' Delete Web Catalog. '
WshShell.RegDelete "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\System\"

' Delete System Catalog. 'Modify existing Web catalog entry
WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\Location", "d:\inetpub"
WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\IsIndexingW3Svc", 1, "REG_DWORD"
end function

'Start Services (WWW, FTP, SMTP, CISVC)
Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Attempting to restart stopped Services..."
Params2(0) = "w3svc"
Params2(1) = "msftpsvc"
Params2(2) = "cisvc"
Params2(3) = "smtpsvc"

For Each x In Params2
ret = WshShell.Run ("net start " & x, 1, TRUE)
wscript.Sleep 5000
Next

If ret = 0 then
WSHShell.PopUp "Services were started successfully, modifications complete"
else
WSHShell.PopUp "One or more services fail to start successfully. The error code is " & ret Wscript.Quit 1
end if

Written by lordfu

March 25, 2010 at 3:54 pm

Unable To Start Debugging on the Web Server because Integrated Windows Authentication is not enabled

leave a comment »

You ever received the error above?

To fix it open Start->Administrative Tools->Internet Information Services

Right click on the website that you are trying to enable debugging on and click “Properties”.

Then click the “Directory Security” tab.

Then click edit on “Anonymous Authentication and Access” control.

Check the box that says “Integrated Windows Authentication”

That should be it.

Written by lordfu

March 20, 2010 at 2:44 pm

HTTP 401.3 – Access denied by ACL on resource Internet Information Services – Metabase Acess Denied

leave a comment »

So you created a virtual directory for a website and get that error eh?

Right click the folder itself and under the security tab add the Everyone group read and execute permissions. Now you can see it.

Now if you get this error as well

Failed to access IIS metabase.
I did after installing IIS for the first time, and after updating .NET versions also.
Aspnet_regiis.exe is a command line utility that installs ASP.NET features to Internet Information Server (IIS). You find it in your c:\windows\microsoft.net\framework\v#.### directory. Installable components include such things as:

* An ISAPI Filter – used by IIS to direct incoming requests to the appropriate asp.net runtime engine based on the extension (e.g. .asp, .aspx)
* Script Maps – configuration settings in each IIS node that specify how various extensions are processed.
* Client Validation Scripts – /aspnet_client Javascripts that provide dynamic behavior to web form validation controls
* Options for encrypting asp.net configuration (*.config) files.
* etc
To uninstall and then reinstall using aspnet_regiis open a command prompt and descend into the directory for the version of .NET you are using (remember that 3.5 uses 2.0* as of this writing anyways) and unregister and then reregister the .NET Framework with IIS

aspnet_regiis.exe -u

aspnet_regiis.exe -i

Hope that helps.

Written by lordfu

February 4, 2010 at 3:44 am