asp.net mvc - Microsoft.Web.Administration assembly error on azure -


i have been trying deploy new asp.net mvc project azure production. works locally i'm having troubles assemblies when deploying.

upon navigating pages, started receiving error of:

unable load 1 or more of requested types. retrieve loaderexceptions property more information. 

using information : https://stackoverflow.com/a/8824250/1411764 caught exception:

could not load file or assembly 'microsoft.web.administration,  version=7.9.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or  1 of dependencies. system cannot find file specified. 

microsoft.web.administration appears iis assembly.

i added microsoft.web.administration project using nuget.

now i'm stuck new error:

could not load file or assembly 'microsoft.web.administration' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) 

i have tried adding binding redirect web.config

<dependentassembly>    <assemblyidentity name="microsoft.web.administration" publickeytoken="31bf3856ad364e35" culture="neutral" />    <bindingredirect oldversion="0.0.0.0-7.9.0.0" newversion="7.9.0.0" /> 

at point breaks straight away , can't load page. (seems worse when didn't have dll.

i've read many similar posts can't seem figure out. i'm doing simple wrong lack of understanding regarding azure. appreciated.

updated info

right clicking properties reference microsoft.web.administration:

copy local: true

runtime version v2.0.50727

version: 7.0.0.0

calling assembly : microsoft.webmatrix.core, version=8.1.0.0, culture=neutral, publickeytoken=31bf3856ad364e35

update 2 - comments:

after settings binding 7.0.0.0 compiles again on server , can display pages i'm still catching previous error.

could not load file or assembly 'microsoft.web.administration, version=7.9.0.0,  culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies.  located assembly's manifest definition not match assembly reference.  (exception hresult: 0x80131040) 

i assume nuget has supplied version 7.0.0.0 thinks needs 7.9.0.0.

update 3: success

i started looking version number differences , found stack question explains differences between iis , iisexpress.

for changed redirect 7.9.0.0 7.0.0.0 seems of solved issue.

<bindingredirect oldversion="0.0.0.0-7.9.0.0" newversion="7.0.0.0" /> 

the assemblies work , pages loading.

this solution feels hacky though. binding lower version bad practice or cause issues in future? i'm worried should addressing code calling different iis versions.

this may not optimal solution, summary of suggestions comments, original question , research , testing did, interpretation of results. hope useful. contributed solving this.

tl;dr: install iis , iis management features on build system or build on system these installed.

this error means application trying load iis express version of microsoft.web.administration, not want on production server.

  • version 7.0.0.0 iis
  • version 7.9.0.0 iis express

(see https://stackoverflow.com/a/11216326/2279059)

to make application work on production system real iis, have build on system iis (not iis express) version of microsoft.web.administration installed, i.e., have install iis , enable iis management feature(s) (which have different names on different windows versions/editions), c:\windows\system32\inetsrv\microsoft.web.administration.dll exists.

in project file, reference dll should this:

<reference include="microsoft.web.administration, version=7.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35, processorarchitecture=msil">   <hintpath>c:\windows\system32\inetsrv\microsoft.web.administration.dll</hintpath>   <specificversion>true</specificversion> </reference> 

(this visual studio 2012 , might different newer versions!)

note if turn off specificversion or set version 7.9.0.0, application still work, long build on system iis , microsoft.web.administration installed. however, if build on system dll missing, application may linked iis express version of dll (which ships visual studio), causing problem described in question. therefore, better specify version. make build fail if dll not installed on build system, easier debug "successful" build produces broken executable.

there nuget package called microsoft.web.administration on web. according older information (https://blog.lextudio.com/2015/05/whats-microsoft-web-administration-and-the-horrible-facts-you-should-know/), not microsoft package , should not used. however, seems microsoft has taken ownership of package. while not find on nuget in visual studio 2012, application wrote in visual studio 2015 uses package , works fine on multiple versions of windows (such windows server 2012 , windows 10, have different versions of iis). using nuget package may therefore resolve of these issues.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -