Recently, I installed a WordPress website in the IIS web server and did all the standard settings in the wordpress admin, like general, reading, permalinks. And when running the site all the URL were with index.php eg. so to remove the index.php from the wordpress site we have to enable directory browsing to true in web.config and add the following rewrite rules in the web.config file.

<?xml version="1.0" encoding="UTF-8"?>
    <directoryBrowse enabled="true"/>
           <add value="index.php"/>
			<rule name="WordPress:" patternSyntax="Wildcard">
				<match url="*"/>
						<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
						<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
				<action type="Rewrite" url="index.php"/>

For this to work, your IIS should have IIS URL REWRITE MODULE installed