Installed Umbraco 8.6.1 from NuGet to my Visual Studio project.
Followed the video on Umbraco.tv (Add CSS and other files). Everything worked except this piece of code on the template:
@{
var typedMediaPickerSingle = Model.Value<IPublishedContent>("gBImage");
if (typedMediaPickerSingle != null)
{
<img src="@typedMediaPickerSingle.Url" style="width:200px" alt="@typedMediaPickerSingle.Value("alt")" />
}
}
My site's address is http://localhost/MySite. The src attribute rendered for the image was "/MySite/MySite/media/rbzlcxqd/MyImage.png". Yes, the MySite part was duplicated. This is not the correct url thus the image did not show up.
I made sure the umbracoApplicationUrl setting was set to "http://localhost/MySite/umbraco" but that didn't seem to help. Any ideas?
I've done more research on this issue and it turns out that I am not alone. This seems to be a persistent issue, i.e.
Running Umbraco in a sub-folder (called an Application in IIS) under a Website in IIS either does not work or requires extra configuration that is not obvious.
I'm not talking about a sub-domain (subdomain.mainsite.com). I'm talking about a sub-folder (mainsite.com/subfolder). In other CMSs that I've worked with, there's usually a single setting (Site URL or something) that when set properly, will ensure that all of the rendered URLs (hyperlinks, src attributes etc.) will be correct.
Running a site under an IIS subfolder is common practice, especially during development and thus it seems like it should be better documented.
I saw a remark somewhere that said it does work but have not found any documentation that addresses this issue. So....
Is it possible to get some clear documentation on if this setup is
supported and if so, what else needs to be done to make everything
work?
I've found the following posts that are all referencing basically the same thing:
I have seen a few partial solutions to this including:
Adding ~ on static href tags
Putting
<location path="." inheritInChildApplications="false">
in various places in the parent web.config (my parent site is the default IIS site and doesn't even have a web.config unless I create one)
Adding a specific web.config file in the media folder. I looked in my media folder and I already had the web.config that was mentioned
Wrong image url rendered
Installed Umbraco 8.6.1 from NuGet to my Visual Studio project.
Followed the video on Umbraco.tv (Add CSS and other files). Everything worked except this piece of code on the template:
}
My site's address is http://localhost/MySite. The src attribute rendered for the image was "/MySite/MySite/media/rbzlcxqd/MyImage.png". Yes, the MySite part was duplicated. This is not the correct url thus the image did not show up.
I made sure the umbracoApplicationUrl setting was set to "http://localhost/MySite/umbraco" but that didn't seem to help. Any ideas?
I've done more research on this issue and it turns out that I am not alone. This seems to be a persistent issue, i.e.
I'm not talking about a sub-domain (subdomain.mainsite.com). I'm talking about a sub-folder (mainsite.com/subfolder). In other CMSs that I've worked with, there's usually a single setting (Site URL or something) that when set properly, will ensure that all of the rendered URLs (hyperlinks, src attributes etc.) will be correct.
Running a site under an IIS subfolder is common practice, especially during development and thus it seems like it should be better documented.
I saw a remark somewhere that said it does work but have not found any documentation that addresses this issue. So....
I've found the following posts that are all referencing basically the same thing:
https://our.umbraco.com/forum/getting-started/installing-umbraco/44013-Publishing-umbraco-as-a-subsite-in-IIS-7
https://our.umbraco.com/forum/developers/api-questions/64995-Setting-up-Umbraco-as-a-subsite-inside-another-Website-Virtual-Directory-converted-to-application-in-IIS
https://our.umbraco.com/forum/umbraco-7/using-umbraco-7/63325-IIS-Sub-folders
https://our.umbraco.com/forum/templates-partial-views-and-macros/81785-iis-throws-error-on-loading-sub-site
https://our.umbraco.com/forum/core/general/46146-Possible-to-publish-in-sub-directory
https://our.umbraco.com/forum/getting-started/installing-umbraco/44013-Publishing-umbraco-as-a-subsite-in-IIS-7
https://our.umbraco.com/forum/getting-started/installing-umbraco/18750-Deploying-Umbraco-Website-to-Sub-Directory
https://our.umbraco.com/forum/umbraco-7/using-umbraco-7/67609-subdomains
https://our.umbraco.com/forum/using/ui-questions/43989-Publishing-umbraco-as-a-subsite-in-IIS-7
https://our.umbraco.com/forum/using-umbraco-and-getting-started/102030-root-folder-showing-up-twice-in-media-url
I have seen a few partial solutions to this including:
Adding ~ on static href tags
Putting
Adding a specific web.config file in the media folder. I looked in my media folder and I already had the web.config that was mentioned
is working on a reply...