2016-11-28 5 views
-1

IIS上でWebアプリケーションを公開した後に画像がページに表示されません。私は、Visual Studio 2015からWebアプリケーションを実行するとIIS上でWebアプリケーションを公開した後に画像がページに表示されない

は、画像が表示されている画像のcorrectly.theパスがある

/media/1713/mypicture.png

のようなしかし、IIS上のWebアプリケーションを公開し、それを実行した後、写真は表示されません。 しかし、上記のパスの最初に手動でドメインを追加すると、画像が正しく表示されます。

/domain-name/media/1713/mypicture.pngと同じです。

私はUmbraco 7.4.3、ASP.NET MVC、VS2015およびWindows 10

EDITを使用しました:私はUMBRACO 7.5.4にアップグレードし、それでも問題があります。 :(

どのように私はこの問題を解決することができ、私を助けてください

umbracosettings.config:?。私は私のCSHTMLでのimgタグを使用しました

<?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>[email protected]</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"> 
+0

マルチサイトのUmbracoインスタンスを実行していますか? /サイトにホスト名が正しく設定されていますか? – cvocvo

+0

Umbraco APIを使用してメディアアイテムのURLを取得する必要があります:https://our.umbraco.org/documentation/Reference/Management/Services/MediaService – cvocvo

+1

"domain-name"について正確に心ですか?私の意見では、IIS構成の問題のように見えます。 web.config()には、パスからトップレベルノードを隠すのに役立つ設定があります。まずこれを試してみてください。ドメインについてもっと詳しく知りたいIIS Webサイトではどのような種類のドメインを使用していますか? –

答えて

-2

通常、イメージをプロジェクトに追加してインクルードするのではなく、IISに送信するビルド/パッケージのイメージを更新しないことがあります。ソリューションエクスプローラでイメージを作成し、ソリューションエクスプローラでイメージを右クリックしてプロパティを選択し、[常にコピー]を選択してプロジェクトをビルドします。次に、IISに発行します。

enter image description here

+0

画像がたくさんあります。そのための一般的な解決策を得てください。 私は管理者が自分の画像をアップロードできる「メディア」というフォルダを持っています。 – Jahan

+1

問題はCMS経由で画像が追加されているため、コードソリューションに含めることはできません。 –

関連する問題