错误web.config将angular 2 app部署到IIS 7.5

时间:2017-10-27 08:24:45

标签: angular deployment web-config iis-7.5

我正在尝试在iis 7中部署我的角度应用程序2.我已经完成了所有步骤: 1º使用“ng build --prod”生成dist文件夹

2º后我从visual studio发布我的项目(右键和发布)来生成项目的dll

3º在IIS中,我有一个新的虚拟目录,并将该文件夹分配给我的发布目录“ReprografiaDeploy”

4º我将index.hml文件的basehref设置为base href =“/ ReprografiaDeploy” 5我修改了我的web.config文件,包括以下内容:

<rewrite>
<rules>
<rule name="AngularJS Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/ReprografiaDeploy" />
</rule>
</rules>
</rewrite>

我的web.config的最终结果如下:

<?xml version="1.0" encoding="utf-8"?>      
        <configuration>
        <configSections>
        <section name="loggingConfiguration" 
        type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <section name="exceptionHandling" 
        type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        </configSections>
        <system.web>
        <compilation targetFramework="4.5.2" />
        <httpRuntime targetFramework="4.5.2" />
        </system.web>
        <system.web.extensions>
        <scripting>
        <webServices>
        <jsonSerialization maxJsonLength="2147483644" />
        </webServices>
        </scripting>
        </system.web.extensions>
        <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="Debug" logWarningsWhenNoCategoriesMatch="true">

        <formatters>
        <add template="Timestamp: {timestamp} Message: {message} Category: {category} Priority: {priority} EventId: {eventid} Severity: {severity} Title:{title} Machine: {machine} Application Domain: {appDomain} Process Id: {processId} Process Name: {processName} Win32 Thread Id: {win32ThreadId} Thread Name: {threadName} Extended Properties: {dictionary({key} - {value} )}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Text Formatter" />
        </formatters>
        <categorySources>
        <add switchValue="All" name="Debug">
        <listeners>
        <add name="FlatFile TraceListener" />
        </listeners>
        </add>
        <add switchValue="All" name="Excepciones">
        <listeners>
        <add name="FlatFile TraceListener" />
        </listeners>
        </add>
        <add switchValue="All" name="ExcepcionesPresentacion">
        <listeners>
        <add name="FlatFile TraceListener Presentacion" />
        </listeners>
        </add>
        </categorySources>
        <specialSources>
        <allEvents switchValue="All" name="All Events" />
        <notProcessed switchValue="All" name="Unprocessed Category" />
        <errors switchValue="All" name="Logging Errors &amp; Warnings" />
        </specialSources>
        </loggingConfiguration>
        <exceptionHandling>
        <exceptionPolicies>
        <add name="Mercurio.Presentacion Policy">
        <exceptionTypes>
        <add type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">
        <exceptionHandlers>
        <add logCategory="ExcepcionesPresentacion" eventId="100" severity="Error" title="Enterprise Library Exception Handling" 
        formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Logging Handler" />
        </exceptionHandlers>
        </add>
        </exceptionTypes>
        </add>
        </exceptionPolicies>
        </exceptionHandling>
        <system.web>
        <customErrors mode="Off"></customErrors>
        <!--<authentication mode="Windows">
        </authentication>-->
        <pages controlRenderingCompatibilityVersion="4.0">
        <controls>
        <add tagPrefix="cc1" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </controls>
        </pages>
        <sessionState timeout="60" />
        </system.web>  
        <system.webServer>
        <rewrite>
        <rules>
        <rule name="AngularJS Routes" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
        </conditions>
        <action type="Rewrite" url="/ReprografiaDeploy" />
        </rule>
        </rules>
        </rewrite>
        <defaultDocument>
        <files>
        <clear />
        <add value="dist/index.html" />
        </files>
        </defaultDocument>  
        <httpProtocol>
        <customHeaders>
        <clear />
        <add name="X-UA-Compatible" value="IE=edge" />
        </customHeaders>
        </httpProtocol>
        <directoryBrowse enabled="true" />
        </system.webServer>
        <system.serviceModel>
        <bindings>
        <basicHttpBinding>
        <binding name="BasicHttpBindingTransport" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" 
        sendTimeout="01:00:00" allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="true">
        <security mode="TransportCredentialOnly">
        <transport clientCredentialType="None" />
        </security>
        </binding>
        <binding name="BasicBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" 
        sendTimeout="01:00:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
        maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
        </security>
        </binding>
        <binding name="BasicHttpBinding_IServicio" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
        <security mode="Transport">
        <transport clientCredentialType="Windows" />
        </security>
        </binding>
        <binding name="BasicHttpBinding_IServicioMarca" />
        <binding name="BasicHttpBinding_IServicioCopiadora" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
        <binding name="BasicHttpBinding_IServicioProveedor" />
        <binding name="BasicHttpBinding_IServicioModelo" />
        <binding name="BasicHttpBinding_IServicioCliente" />
        <binding name="BasicHttpBinding_IServicioMarcaModelo" />
        <binding name="BasicHttpBinding_IServicioFacLec" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
        <binding name="BasicHttpBinding_IServicioEdificio" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
        <binding name="BasicHttpBinding_IServicioUbicacion" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
        <binding name="BasicHttpBinding_IServicioContacto" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
        <binding name="BasicHttpBinding_IServicioContrato" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
        </basicHttpBinding>
        <wsHttpBinding>
        <binding name="HttpsBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" 
        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        <security mode="Transport">
        <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
        </security>
        </binding>
        </wsHttpBinding>
        </bindings>
        <client>
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioMarca.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioMarca" contract="ServicioClient.ServicioMarca.IServicioMarca" name="BasicHttpBinding_IServicioMarca" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioCopiadora.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioCopiadora" contract="ServicioClient.ServicioCopiadora.IServicioCopiadora" name="BasicHttpBinding_IServicioCopiadora" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioProveedor.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioProveedor" contract="ServicioClient.ServicioProveedor.IServicioProveedor" name="BasicHttpBinding_IServicioProveedor" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioModelo.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioModelo" contract="ServicioClient.ServicioModelo.IServicioModelo" name="BasicHttpBinding_IServicioModelo" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioCliente.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioCliente" contract="ServicioClient.ServicioCliente.IServicioCliente" name="BasicHttpBinding_IServicioCliente" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioMarcaModelo.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioMarcaModelo" contract="ServicioClient.ServicioMarcaModelo.IServicioMarcaModelo" name="BasicHttpBinding_IServicioMarcaModelo" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioFacLec.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioFacLec" contract="ServicioClient.ServicioFacLec.IServicioFacLec" name="BasicHttpBinding_IServicioFacLec" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioContrato.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioContrato" contract="ServicioClient.ServicioContrato.IServicioContrato" name="BasicHttpBinding_IServicioContrato" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioEdificio.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioEdificio" contract="ServicioClient.ServicioEdificio.IServicioEdificio" name="BasicHttpBinding_IServicioEdificio" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioUbicacion.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioUbicacion" contract="ServicioClient.ServicioUbicacion.IServicioUbicacion" name="BasicHttpBinding_IServicioUbicacion" />
        <endpoint address="http://localhost/apps/Reprografia.Servicios/ServicioContacto.svc" binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpBinding_IServicioContacto" contract="ServicioClient.ServicioContacto.IServicioContacto" name="BasicHttpBinding_IServicioContacto" />
        </client>
        <behaviors>
        <endpointBehaviors>
        <behavior>
        <dataContractSerializer maxItemsInObjectGraph="2147483646" />
        </behavior>
        </endpointBehaviors>
        </behaviors>
        </system.serviceModel>  
        <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31BF3856AD364E35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.414.0" newVersion="2.0.414.0" />
        </dependentAssembly>
        <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
        </dependentAssembly>
        <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31BF3856AD364E35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
        </dependentAssembly>
        <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
        </dependentAssembly>
        </assemblyBinding>
        </runtime>
        <system.codedom>
        <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" 
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
        <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
        </compilers>
        </system.codedom>
        </configuration>

当我运行网址http://localhost/apps/ReprografiaDeploy/时,我在节点重写内部出现web.config错误

错误HTTP 500.19 - 内部服务器错误

0 个答案:

没有答案