我需要帮助将VueJS应用程序作为附加应用程序部署到IIS默认网站。
我可以在新端口(端口80除外)上将构建的Vue站点添加为其自己的IIS网站。我将vue.config.js publicPath属性更改为“ ./”,然后将新站点指向已构建的“ dist”文件夹。这很不错
当我尝试在默认网站下添加新的“应用程序”时,我无法工作。这使您可以使用默认端口(80),只需将“别名”名称附加到URL。例如-localhost / myvuesite
过去,我已经使它与其他公司的ASP.NET网站可以正常工作,但是我无法与Vue一起工作。当我尝试导航到新创建的站点localhost / myvuesite时,我只得到一个空白页面,没有任何可显示的内容。当我检查Chrome来源时,似乎该网站下载了.js和.css和index.html文件,但是某些文件无法正常工作。
“ dist”目录中的web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/500" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
vue.config.js:
module.exports = {
publicPath: './',
productionSourceMap: false
};
文件结构:
myvuesite
- css
- img
- js
- favicon.ico
- index.html
- web.config