我正在開發一個與 Optimizely CRM 結合使用的 .Net 應用程式。我想訪問一個json檔案,比如
www.abc.com/.well-known/assetlinks.json
但我可以從本地訪問
https://localhost:44300/.well-known/assetlinks.json
但是當我嘗試在測驗環境中部署時,我得到了這個錯誤
www.abc.com/.well-known/assetlinks.json 404 未找到
任何幫助都會受到高度評價。
uj5u.com熱心網友回復:
確保您的 iis 或 iisexpress 被允許發送 JSON 檔案。這通常可以通過在 web-config 中設定以下屬性來完成
<mimeMap fileExtension=".json" mimeType="application/json" />
該元素的樣本將是
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00"/>
<!--cacheControlCustom="public"-->
<remove fileExtension=".woff"/>
<remove fileExtension=".woff2"/>
<remove fileExtension=".otf"/>
<remove fileExtension=".ttf"/>
<remove fileExtension=".eot"/>
<mimeMap fileExtension=".woff" mimeType="application/font-woff"/>
<remove fileExtension=".woff2"/>
<mimeMap fileExtension=".woff2" mimeType="font/woff2"/>
<mimeMap fileExtension=".otf" mimeType="application/x-font-opentype"/>
<mimeMap fileExtension=".ttf" mimeType="application/x-font-ttf"/>
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject"/>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
<system.webServer>
uj5u.com熱心網友回復:
您必須在 Web 應用程式的 wwwroot 檔案夾中創建一個名為 .well-known 的檔案夾。在此之后復制 .well-known 檔案夾中的asselikns.json 檔案。
還要檢查你是否有 json 作為 MIME 型別
在 IIS 管理器中打開 IIS 服務器的屬性,然后單擊 MIME 型別。如果您沒有 .json,則單擊“添加”并輸入“.json”作為擴展名,輸入“application/json”作為 MIME 型別。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/446780.html
標籤:。网 asp.net-mvc 表观服务器
上一篇:宣告DI物件的最佳方式
