UNC as UmbracoMediaPhysicalRootPath
# help-with-umbraco
k
Working on Umbrac 10.4.0. Trying to use a network share as media with the config setting of UmbracoMediaPhysicalRootPath. Tried \\\\xx.xx.xx\\media and also mapping this to a network drive Z:\\ but on startup I get Directory not found for... The code in Umbraco calls Directory.Exists which fails. Thinking this is caused by the user my site is using, being ApplicationPoolIdentity which doesn't seem to have access to network shares. Does this only work when using a domain user to host your site?
j
Yeah you guessed right, as you're running the site off IIS it will use that applications identifier when checking permissions to access a network share. You could use something like this https://github.com/mattjohnsonpint/SimpleImpersonation Which allows you to impersonate a windows user to access the share and end up doing something like var credentials = new UserCredentials(domain, username, password); var result = Impersonation.RunAsUser(credentials, logonType, () => { return System.IO.Directory.GetFiles( @"\\server\share" ); });
k
yeah suddenly realised the base setup of most is running through IIS Express which uses your local user account. For IIS, can also use that local user account as applicationpoolidentity. Also fixes issue for using user secrets.
2 Views