I want to find the physical path on the IIS website, the path to the root of the website using the Microsoft.Web.Administration.NET assembly.
There is no single method for this, but I wonder - this is the following procedure:
Lee
, . , , , :1) , ( , (ip, ..)).2) , URL-.3) VirtualDirectory , URL-.4) Path.Combine(vdir.PhysicalPath, " URL- / \" )
. , URL- ( , MVC Rewriting), .
,
ServerManager sm = new ServerManager(); sm.Sites["Default Web Site"].Applications["/"].VirtualDirectories["/"].PhysicalPath;
http://forums.iis.net/t/1146686.aspx/1
To list the entire virtual and physical path from the server:
Dim stringIIS As String = String.Empty Dim serverName As String = "MACHINE_NAME" Dim sm1 As New ServerManager() Using sm As Microsoft.Web.Administration.ServerManager = Microsoft.Web.Administration.ServerManager.OpenRemote(serverName) Dim counter As Integer = 1 For Each Site As Microsoft.Web.Administration.Site In sm.Sites stringIIS = "Site: " & Site.Name & (vbNewLine) For Each app As Microsoft.Web.Administration.Application In sm.Sites(Site.Name).Applications stringIIS = stringIIS & " Physical Path: " & (vbTab & sm1.Sites(Site.Name).Applications("/").VirtualDirectories("/").PhysicalPath().ToString() & vbNewLine) For Each virtDir As Microsoft.Web.Administration.VirtualDirectory In app.VirtualDirectories stringIIS = stringIIS & " Virtual Path: " & (vbTab & app.Path & vbNewLine) stringIIS = stringIIS & vbNewLine Next Next counter += 1 Next iis.Text = stringIIS iis.Visible = True End Using
Source: https://habr.com/ru/post/1778093/More articles:how to use rake db: migrate - ruby-on-railsMemory leak in MyFaces - memory-leakschanging background color via jQuery AJAx? - javascriptProblem with h: form and p: ajax (Mojarra 2.0.2 and Primefaces 2.0.2) - ajaxWhy is the INSTEAD OF UPDATE insert table INSERTED empty? - sqlHow to switch to full screen mode in Xcode? - xcodeSoundex and invalid sound checking - sql-serverUITextField Email Autofill Feature - EmailHow to avoid this purple flash on Chrome when using transitions? - google-chromeEclipse environment variables - javaAll Articles