在IIS上发布web应用程序后,图像不会显示在页面上

在IIS上发布web应用程序后,图像不会显示在页面上,iis,umbraco,umbraco7,webdeploy,Iis,Umbraco,Umbraco7,Webdeploy,在IIS上发布web应用程序后,图像不会显示在页面上 当我从Visual Studio 2015运行web应用程序时,图片显示正确 /media/1713/mypicture.png 但是在IIS上发布web应用程序并运行它之后,图片不会显示。 但是当我在上面路径的第一个手动添加域时,图像显示正确。同 /domain name/media/1713/mypicture.png 我使用过Umbraco 7.4.3、ASP.NET MVC、VS2015和Windows 10 编辑:我将其升级为UMB

在IIS上发布web应用程序后,图像不会显示在页面上

当我从Visual Studio 2015运行web应用程序时,图片显示正确

/media/1713/mypicture.png

但是在IIS上发布web应用程序并运行它之后,图片不会显示。 但是当我在上面路径的第一个手动添加域时,图像显示正确。同

/domain name/media/1713/mypicture.png

我使用过Umbraco 7.4.3、ASP.NET MVC、VS2015和Windows 10

编辑:我将其升级为UMBRACO 7.5.4,但仍然存在问题。 :(

我怎样才能解决这个问题?请帮助我

umbracosettings.config:


1.
your@email.here
文本
1800
扔
ashx、aspx、ascx、config、cshtml、vbhtml、asmx、air、axd、swf、xml、html、htm、svg、php、htaccess
文本字符串
假的
假的
假的
真的
Mvc
0
我在cshtml文件中使用了img标记,如下所示:


有时,如果您在project中添加的图像不是以通常的方式包含的,它将不会更新要提交给IIS的生成/包中的图像。在解决方案资源管理器中创建图像,右键单击解决方案资源管理器中的图像并选择“属性”,然后选择“始终复制”和生成项目。然后发布到IIS


有很多图像。请为其找到一个通用解决方案。我有一个文件夹“media”该管理员可以上传他/她的图像。问题在于通过CMS添加的图像,因此它们不能包含在代码解决方案中。您是否正在运行多站点Umbraco实例?/您是否在站点上正确设置了主机名?您可能需要使用Umbraco API“获取”媒体项目的URL:谈论“域名”你到底在想什么?在我看来,这更像是IIS配置问题。web.config()中有一个设置,可以帮助你从路径中隐藏顶级节点。请先尝试一下。并共享有关域的更多信息。你在IIS网站上使用的域类型是什么?我创建了一个名为“art And cake”的文件夹在这个路径中C:\inetpub\wwwroot\art and cake。域名是“art and cake”,我检查了umbrachidetoplevelnodeFrompath的值。它是“true”。所以你需要在IIS上设置一个网站并将其指向这个目录。现在你正试图从根应用程序浏览它,它指向正确路径(具有目录名)的图像。检查:。
<?xml version="1.0" encoding="utf-8" ?>
<settings>

  <content>

    <errors>
      <error404>1</error404>
    </errors>

    <notifications>
      <!-- the email that should be used as from mail when umbraco sends a notification -->
      <email>your@email.here</email>
    </notifications>

    <!-- Show property descriptions in editing view "icon|text|none" -->
    <PropertyContextHelpOption>text</PropertyContextHelpOption>

    <!-- The html injected into a (x)html page if Umbraco is running in preview mode -->
    <PreviewBadge>
      <![CDATA[<a id="umbracoPreviewBadge" style="position: absolute; top: 0; right: 0; border: 0; width: 149px; height: 149px; background: url('{1}/preview/previewModeBadge.png') no-repeat;z-index: 9999999;" href="#" OnClick="javascript:window.top.location.href = '{0}/endPreview.aspx?redir={2}'"><span style="display:none;">In Preview Mode - click to end</span></a>]]></PreviewBadge>

    <!-- Cache cycle of Media and Member data fetched from the umbraco.library methods -->
    <!-- In seconds. 0 will disable cache -->
    <UmbracoLibraryCacheDuration>1800</UmbracoLibraryCacheDuration>

    <!-- How Umbraco should handle errors during macro execution. Can be one of the following values:
         - inline - show an inline error within the macro but allow the page to continue rendering. Historial Umbraco behaviour.
         - silent - Silently suppress the error and do not render the offending macro.
         - throw  - Throw an exception which can be caught by the global error handler defined in Application_OnError. If no such
                    error handler is defined then you'll see the Yellow Screen Of Death (YSOD) error page.
         Note the error can also be handled by the umbraco.macro.Error event, where you can log/alarm with your own code and change the behaviour per event. -->
    <MacroErrors>throw</MacroErrors>

    <!-- These file types will not be allowed to be uploaded via the upload control for media and content -->
    <disallowedUploadFiles>ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,html,htm,svg,php,htaccess</disallowedUploadFiles>

    <!-- Defines the default document type property used when adding properties in the back-office (if missing or empty, defaults to Textstring -->
    <defaultDocumentTypeProperty>Textstring</defaultDocumentTypeProperty>
  </content>

  <security>
    <!-- set to true to auto update login interval (and there by disabling the lock screen -->
    <keepUserLoggedIn>false</keepUserLoggedIn>
    <!-- change in 4.8: Disabled users are now showed dimmed and last in the tree. If you prefer not to display them set this to true -->
    <hideDisabledUsersInBackoffice>false</hideDisabledUsersInBackoffice>
  </security>

  <requestHandler>
    <!-- this will ensure that urls are unique when running with multiple root nodes -->
    <useDomainPrefixes>false</useDomainPrefixes>
    <!-- this will add a trailing slash (/) to urls when in directory url mode -->
    <addTrailingSlash>true</addTrailingSlash>   
  </requestHandler>

  <templates>
    <!-- To switch the default rendering engine to MVC, change this value from WebForms to Mvc -->
    <defaultRenderingEngine>Mvc</defaultRenderingEngine>
  </templates>

  <scheduledTasks>
    <!-- add tasks that should be called with an interval (seconds) -->
    <!--    <task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>-->
  </scheduledTasks>

  <!-- distributed calls must be enabled when using Umbraco in a load balanced environment -->
  <distributedCall enable="false">
    <!-- the id of the user who's making the calls -->
    <!-- needed for security, umbraco will automatically look up correct login and passwords -->
    <user>0</user>

    <!--
    When distributed call is enabled, you need to add all of the servers part taking in load balancing
    to the server list below. 
    -->

    <servers>

    </servers>
  </distributedCall>
  <web.routing
    trySkipIisCustomErrors="false"
    internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false"
    umbracoApplicationUrl="">
  </web.routing>

</settings>
<img style="display: block;" src="@Model.Model.MainPicture" alt="@Model.Model.FirstTitle">