这些文件没有在IIS服务器中的MVC框架中加载
我第一次在IIS服务器上使用MVC框架。 我将.htaccess更改为web.config,并且正在发生非常奇怪的事情。 一些.cs和.js文件已加载,有些则没有。我完全不明白。 For example these files load correctly:
<script src="/assets/plugins/global/plugins.bundle.js"></script>
<script src="/assets/js/scripts.bundle.js"></script>
But for example this file is not loading:
<script src="/assets/js/custom/authentication/sign-in/general.js"></script>
my folders look like this:
-wwwroot
web.config
-public
-assets
-js
-...
Maybe there is a problem in the configuration file.如果我在.js文件的地址之前写入文件夹 / public的名称,那么一切都很好。 也许你们中的一些人也有类似的问题,并且知道如何解决 Below is my configuration file code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<rewrite>
<rules>
<rule name="rule 1p" stopProcessing="true">
<match url="^$"/>
<action type="Rewrite" url="public/" />
</rule>
<rule name="rule 2p" stopProcessing="true">
<match url="^(.*)$"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="public/index.php?{R:1}" appendQueryString="true"/>
</rule>
<rule name="phpmyadmin" stopProcessing="true">
<match url="(.*)phpmyadmin(.*)" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
EDIT
I changed physical path on the server to: C:\inetpub\wwwroot\public
and also replace web.config to public folder
-wwwroot
-public
-web.config
-assets
-js
-...
my web.congif file :
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="rule 1p" stopProcessing="true">
<match url="^(.+)/$"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="/{R:1}" />
</rule>
<rule name="Rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
The only problem I have right now is that the main page is not showing up.所有子页面都可以正常工作,包括JS和CSS文件。 当我想显示我的主页EX时。 mypage.com,然后我遇到了一个错误:
http错误403.14-禁止将Web服务器配置为未列出 此目录的内容。详细的错误信息:模块DirectoryListingModule通知executereQuesthandler处理程序
静态文件错误代码0x00000000请求URL Localhost
物理路径C:\ inetpub \ wwwroot \ public 登录方法匿名登录用户匿名
when I want to display the home page after by mypage.com/home/index
then the page is displayed but without js and css files
My first time using mvc framework on a iis server.
I changed the .htaccess to web.config and very strange things are happening.
some .css and .js files are loaded, some are not. I totally don't get it.
For example these files load correctly:
<script src="/assets/plugins/global/plugins.bundle.js"></script>
<script src="/assets/js/scripts.bundle.js"></script>
But for example this file is not loading:
<script src="/assets/js/custom/authentication/sign-in/general.js"></script>
my folders look like this:
-wwwroot
web.config
-public
-assets
-js
-...
Maybe there is a problem in the configuration file. If I write name of folder / public / before the address to the .js files, then everything is good.
Maybe some of you had a similar problem and know how to solve it
Below is my configuration file code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<rewrite>
<rules>
<rule name="rule 1p" stopProcessing="true">
<match url="^quot;/>
<action type="Rewrite" url="public/" />
</rule>
<rule name="rule 2p" stopProcessing="true">
<match url="^(.*)quot;/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="public/index.php?{R:1}" appendQueryString="true"/>
</rule>
<rule name="phpmyadmin" stopProcessing="true">
<match url="(.*)phpmyadmin(.*)" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
EDIT
I changed physical path on the server to: C:\inetpub\wwwroot\public
and also replace web.config to public folder
-wwwroot
-public
-web.config
-assets
-js
-...
my web.congif file :
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="rule 1p" stopProcessing="true">
<match url="^(.+)/quot;/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="/{R:1}" />
</rule>
<rule name="Rule" stopProcessing="true">
<match url="^(.*)quot; ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
The only problem I have right now is that the main page is not showing up. All subpages work properly, including js and css files.
when i want to display my home page ex. mypage.com then i get such an error:
HTTP Error 403.14 - Forbidden The Web server is configured to not list
the contents of this directory. Detailed Error Information: Module DirectoryListingModule Notification ExecuteRequestHandler Handler
StaticFile Error Code 0x00000000 Requested URL localhost
Physical Path C:\inetpub\wwwroot\public
Logon Method Anonymous Logon User Anonymous
when I want to display the home page after by mypage.com/home/index
then the page is displayed but without js and css files
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此问题可能会发生,因为网站没有启用目录浏览功能。要解决此问题,您可以尝试使用以下方法:
This problem may occurs because the website doesn't have the Directory Browsing feature enabled. To resolve this problem,you can try use the following methods: