Angular 4-在线部署应用程序时无法删除任何内容

时间:2018-08-29 13:13:00

标签: angular post iis web-config

我们在Angular 4中制作的应用程序存在严重问题:我们使用发布请求进行删除,当我尝试删除某些内容时,在浏览器开发工具中出现“方法不允许(405)”错误。

当我在本地主机上运行应用程序时,不会发生此错误。我尝试将应用程序连接到本地数据库,测试数据库(在主机上)并删除工作正常,但是在部署了该应用程序的服务器上,删除无效,并抛出405。

enter image description here

这是web.release.config:

    <?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <!--
    In the example below, the "SetAttributes" transform will change the value of 
    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
    finds an attribute "name" that has a value of "MyDB".

    <connectionStrings>
      <add name="MyDB" 
        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
  -->

  <appSettings>
    <add key="multilanguage" value="false" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
    <add key="rootAction" value="Release" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
    <add key="errorLogger" value="true" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
    <add key="traceLogger" value="true" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
  </appSettings>
  <system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
    <!--
      In the example below, the "Replace" transform will replace the entire 
      <customErrors> section of your web.config file.
      Note that because there is only one customErrors section under the 
      <system.web> node, there is no need to use the "xdt:Locator" attribute.

      <customErrors defaultRedirect="GenericError.htm"
        mode="RemoteOnly" xdt:Transform="Replace">
        <error statusCode="500" redirect="InternalError.htm"/>
      </customErrors>
    -->
  </system.web>

  <system.webServer xdt:Transform="InsertIfMissing">
    <rewrite>
      <rules>
        <rule name="Redirect to http" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
          <match url="*" negate="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{HTTPS}" pattern="off" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

</configuration>

0 个答案:

没有答案