Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

Wednesday, March 16, 2011

Windows Authentication using local developer server

I'm developing an ASP.NET application which needs Windows Authentication. I have the web.config set up to deny anonymous users and use Windows mode for authentication, but my local development version still lets me pass right through to the site. In order to test different user set-ups, I need to force authorization so I can change users.
How do I set up my system (config files, VS2005 settings, IIS, etc?) to force the authorization window to popup on the site when I'm running on local asp.net development server? In other words, how do I get the authentication popup when running the site in Debug mode?

You will also need to configure IIS and have your application point to IIS instead of the local web server
To configure Windows authentication
  1. Start Internet Information Services (IIS).
  2. Right-click your application's virtual directory, and then click Properties.
  3. Click the Directory Security tab.
  4. Under Anonymous access and authentication control, click Edit.
  5. Make sure the Anonymous access check box is not selected and that Integrated Windows > authentication is the only selected check box.
http://msdn.microsoft.com/en-us/library/ms998358.aspx
To configure your application to point to IIS
  1. Right click on your web project, and then click Properties
  2. Click the Web tab
  3. Click the "Use Local IIS Web Server" radio button

Friday, March 4, 2011

Install IIS WMSvc

The default IIS 7 installation options do not include the Management Service (also referred to as the Web Management Service (WMSVC)), which is required for remote administration. If you have not installed the Management Service, follow the steps in this procedure to install it.
To install the Management Service:
  1. Click Start, type Server Manager in the Search box, and press ENTER to open Server Manager.
  2. In the tree, under Roles, select Web Server (IIS).
  3. Click Add role services, and then select Management Service as shown in the image below.
  4. Click Next and follow the instructions to complete the installation.

Publishing your website to a remote server

"I have always felt that publishing a site so it works on your remote server is a little bit of a black art. Many stars have to align:
  1. Files and databases have to transfer
  2. Settings such as connection strings have to transform to remote values
  3. Remote server has to be configured properly e.g. must have all dependencies installed
WebMatrix makes no. 1 and 2 significantly easier – it includes support for Web Deploy, FTP and FTPS protocols to transfer content. Second, if you are using Web Deploy, settings are automatically transformed so they work on the remote server. Still, things can go wrong … here are the most common publishing errors and solutions for them:

Error: “The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v2.0'. This application requires 'v4.0'.”

Solution: An application pool provides isolation for websites. Typically, web hosting providers create one application pool per website, and set default values for a number of attributes. One of these attributes is the version of the .NET framework. The user can often change this value between .NET 2.0 and .NET 4.0 through the web hosting provider’s control panel. You will see this error during publishing if you are publishing an ASP.NET Web Pages application, which requires .NET 4.0, to a hoster who has given you a website with a .NET 2.0 application pool. Similarly, you will see this error if you are publishing an application that requires .NET 2.0 to a website associated with an .NET 4.0 application pool. The solution is to set the .NET framework version in the web hosting provider’s control panel or, if there are no compatibility issues, change your application’s .NET framework version in WebMatrix’s Settings workspace.

Error: “Username or password incorrect” error when using Web Deploy

Solution: This is probably because the value in Site Name is incorrect. Site Name must contain the name of the IIS site on the remote server. Typically, it matches your domain name, but it doesn’t have to. For example, it can be “Default Web Site” (if you have a dedicated server) or “foo” or “foo.com”. Web Deploy must authenticate to the site before it can execute any providers.

Error: Web management service not started on destination

Solution: You may see this error if you are deploying to a server you have set up yourself. Web Deploy requires a service called Web Management Service (wmsvc) to be running on the remote server. You can get this error if the service is not started. This blog post is a good starting point to learn how to configure a remote server with Web Deploy and wmsvc.

Error: Failed to invoke provider “iisApp”

Solution: Under the covers, WebMatrix users Web Deploy’s iisApp provider to sync files and directories, and to mark folders as applications. You may see this error if delegation rules are not configured correctly on the remote server. Delegation rules allow the user to execute some actions that require administrative privileges, such as marking a folder as an application. This blog post and this one gives good information on how to configure delegation rules.

Error: Bad gateway: check proxy settings

Solution: This one is literally what it says – check proxy settings because Web Deploy traffic is being blocked. Try installing your corporation’s required firewall client, and disabling all settings in Internet Explorer > Tools > Options > Connections > LAN settings.
 "

Thursday, November 4, 2010

Can not Start Windows Process Activation Service

Got an error message after uninstall IIS7 on windows 2008 R2, and deleted the C:\inetpub folder.

"The Windows Process Activation Service service terminated with the following error:
The system cannot find the file specified."


 http://technet.microsoft.com/en-us/library/cc734935.aspx, which has, as the first option for solving this problem:

To resolve this issue, make sure that the appPools directory meets the following requirements:
- The directory must exist.
- The directory cannot be on a UNC path.
- The directory must be available to WAS and should have the following permissions:
* SYSTEM: Full Access
* Administrators: Full Access
* IIS_IUSRS: Read

Thursday, October 28, 2010

Wednesday, October 27, 2010

Configure Pretty Permalinks for WordPress on IIS 7+

Using Permalinks

Permalinks are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings. A permalink is what another weblogger will use to link to your article (or section), or how you might send a link to your story in an e-mail message. The URL to each post should be permanent, and never change — hence permalink.

Permalink Types

There are three basic types of WordPress permalinks:

Default: "Ugly"

The default looks like
http://example.com/?p=N
where N is the Post ID number. It works on all server environments, but it doesn't look as nice as some of the other options.

mod_rewrite: "Pretty Permalinks"

Using mod_rewrite or lighttpd you can produce much nicer permalinks (see Pretty Permalinks). There are many different formats, but the most common, and most versatile looks like
http://example.com/category/post-name/
or  http://example.com/year/month/day/post-name
Some people eliminate some or all of the date elements (day, month, year) to have a shorter permalink format.
Pretty permalinks are available under
  • Apache web server with the mod_rewrite module
  • Microsoft IIS 7+ web server with the URL Rewrite 1.1+ module and PHP 5 running as FastCGI
  • Microsoft IIS 6+ using ASAPI_Rewrite
  • Lighttpd using a 404 handler or mod_rewrite (see See Also)

PATHINFO: "Almost Pretty"

PATHINFO permalinks look very much like mod_rewrite permalinks but for one exception: they have /index.php inserted before them, like so:
http://example.com/index.php/yyyy/mm/dd/post-name/
Otherwise, they are the same as the "pretty" mod_rewrite permalinks, and are similarly flexible. Anything that mod_rewrite permalinks can do, PATHINFO permalinks can do, with the help of that /index.php part.
There is a helpful plugin that displays the type of permalinks being used and detailed information on the internal rewrite rules used by WordPress.

Choosing your permalink structure

In the Settings → Permalinks panel (Options → Permalinks before WordPress 2.5), you can choose one of the "common" structures or enter your own in the "Custom structure" field using the structure tags.
Please note: You never, ever put your site url in the permalinks slot. You must use one of the structure tags, or a combination of tags only.
%year% 
The year of the post, four digits, for example 2004
%monthnum% 
Month of the year, for example 05
%day% 
Day of the month, for example 28
%hour% 
Hour of the day, for example 15
%minute% 
Minute of the hour, for example 43
%second% 
Second of the minute, for example 33
%postname% 
A sanitized version of the title of the post (post slug field on Edit Post/Page panel). So “This Is A Great Post!” becomes this-is-a-great-post in the URI (see Using only %postname%). Starting Permalinks with %postname% is strongly not recommended for performance reasons..
%post_id% 
The unique ID # of the post, for example 423
%category% 
A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URI. Starting Permalinks with %category% is strongly not recommended for performance reasons.
%tag% 
A sanitized version of the tag name (tag slug field on New/Edit Tag panel). Starting Permalinks with %tag% is strongly not recommended for performance reasons
%author% 
A sanitized version of the author name. Starting Permalinks with %author% is strongly not recommended for performance reasons

Using "Pretty" permalinks (IIS)


Permalinks without mod_rewrite

"Pretty" permalinks usually require mod_rewrite, and IIS (common on Windows servers) does not support mod_rewrite. (If you are using Apache 2.0.54, on Windows, mod_rewrite may work, provided it is enabled in apache\conf\httpd.conf.)
If you are using IIS 7 and have admin rights on your server, you can use Microsoft's URL Rewrite Module instead. Though not completely compatible with mod_rewrite, it does support WordPress's pretty permalinks. Once installed, open the web.config file in the WordPress folder and add the following rule to the system.webServer element
<rewrite>
    <rules>
        <rule name="Main Rule" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:0}" />
        </rule>
    </rules>
</rewrite>
There's a full installation guide on the IIS site.

Download URL Rewrite Module 2.0
  • English: WebPI / x86 / x64
  • Tuesday, October 26, 2010

    Download and Install Database Manager 1.0 to manage MySQL

    To configure IIS to manage MySQL: IIS DB Manager, it can be obtained from the IIS Extensions site.
    Us this link below to download:
    Download Database Manager 1.0

  • English: WebPI / x86 / x64



  • If you have installed WebPI, then click "WebPI" link will run the Web Platform installer and install the Data Manager.  The WebPI will find the dependency and install them for you.

    Thursday, October 7, 2010

    Configure IIS so it can run PHP scripts (on development machine)

    1. Your server roles is as an Application Server
    2. Install FastCGI from http://www.iis.net/expand/fastcgi (I’m using the latest release version and not the 1.5 RC)
    3.  Install PHP for Windows, which you can get at  http://windows.php.net/download (currently version 5.3.1). You may select the ‘non-thread safe version’, as recommended by http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60 (section entitled ‘Download and Install PHP’)
    4.  Select ‘IIS FastCGI’ and it will associate the FastCGI ISAPI filter with IIS , meaning you can skip the section ‘Configuring FastCGI Extension to Work with PHP’ on the iis link above.
    5. To test PHP has been installed successful, create a folder and add a file index.php to it (e.g. put the file under C:\phpwebs\phpinfo with the  the following code in it:
      1. <?php phpinfo(); ?>
      • Then go into the IIS Manager in administrative tools, and under Websites/Default Web Site, create a new virtual directory. Give it a name (e.g. phpinfo) and select the folder you created, ticking Read and Execute permissions.
      • Open up a browser and navigate to http://localhost/phpinfo. You should see the classic PHPInfo screen with the Server API down as CGI/FastCGI.

    Verify or install ASP.NET and IIS on Windows Server

    The ASP.NET component also may or may not be installed by default along side IIS.  Verify or install as follows:
    Windows Server
    -   IIS and ASP.NET are most easily installed using the “Manage Your Server” tool.  They are both installed by adding the “Application Server” role to the server.  Add this role via “Manage Your Server” if this role is not already displayed.
    -   Sometimes an IIS installation or installation of a service pack or security patch will turn off the ASP.NET extension in IIS as a security exposure.   Either select “Manage this application server” from the “Manage Your Server” tool, or start the IIS Manager tool directly from Start/Administrative Tools/IIS Manager.  Once there, expand “Internet Information Services” the “local computer” then click “Web Service Extensions” in the tree view.  This will show the installed extensions and whether they are enabled or prohibited.  Any line that starts “ASP.NET” needs to show “Allowed”.  If it shows Prohibited, select that entry and click “Allow” in the right hand window.