1

I'm having a strange issue with Microsoft.Web.Adminstration 7.9.0.0 for IISExpress requiring run as administrator on Server 2012.

What I'm trying to do is add a Website to a custom ApplicationHost.config file using powershell.

I've tested my powershell script on windows 10 and windows 8.1 and both work with out admin, but I'm stuck with Server 2012.

I thought it could be something to do with a conflict between DLL versions IE 7.0.0.0 and 7.9.0.0.

I've added the DLL next to the file, but Add-Type keeps loading it from the GAC. Very annoying.

The only thing I can think of now is; there's some sort of GAC permission issue. Which doesn't make sense.

# Copied the DLL from C:\Windows\assembly\GAC_MSIL\Microsoft.Web.Administration\7.9.0.0__31bf3856ad364e35\Microsoft.Web.Administration.dll
$assemblyPath = "{Path to dll}\Microsoft.Web.Administration.dll"
Add-Type -LiteralPath $assemblyPath

# This shows Microsoft.Web.Administration loading from the GAC. 
[appdomain]::currentdomain.getassemblies()

$iisApplicationConfig = $(Resolve-Path "{Path to applicationhost.config}\applicationhost.config")
$serverManager = New-Object -TypeName Microsoft.Web.Administration.ServerManager -ArgumentList @($iisApplicationConfig)
$site = $serverManager.Sites[$BuildDefaultProjectName]
0

I can tell you what's forcing it to use 7.9.0.0

look in here: C:\Program Files (x86)\IIS Express\config\templates\PersonalWebServer\aspnet.config

there is a redirect.

<dependentAssembly>
<assemblyIdentity name="Microsoft.Web.Administration"
publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<bindingRedirect oldVersion="7.0.0.0"
newVersion="7.9.0.0" />
<codeBase version="7.9.0.0"
href="FILE://%FalconBin%/Microsoft.Web.Administration.dll" />
</dependentAssembly>

you could try the full IIS admin package directly https://www.nuget.org/packages/Microsoft.Web.Administration

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.