Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET MVC部署到iis而不是自动编译_C#_Asp.net_Iis_Deployment_Compiled - Fatal编程技术网

C# ASP.NET MVC部署到iis而不是自动编译

C# ASP.NET MVC部署到iis而不是自动编译,c#,asp.net,iis,deployment,compiled,C#,Asp.net,Iis,Deployment,Compiled,我有一个ASP.NET(Framework4.6.1)MVC项目, 如果我部署到IIS是整个项目,它可以工作。 但如果我只更改一些.cs或.cshtml文件,iis将不会重新编译 我想问: 我是否可以更改一些.cs或.cshtml文件以允许重新编译iis,而不是每次上载整个项目 我的系统信息 ASP.NET(Framework4.6.1)MVC项目 EntityFramework,版本=6.0.0.0 IIS 7.5集成 web.config <?xml version="1.0" en

我有一个ASP.NET(Framework4.6.1)MVC项目, 如果我部署到IIS是整个项目,它可以工作。 但如果我只更改一些.cs或.cshtml文件,iis将不会重新编译

我想问: 我是否可以更改一些.cs或.cshtml文件以允许重新编译iis,而不是每次上载整个项目

我的系统信息

  • ASP.NET(Framework4.6.1)MVC项目
  • EntityFramework,版本=6.0.0.0
  • IIS 7.5集成
  • web.config

     <?xml version="1.0" encoding="utf-8"?>
        <configuration>
          <configSections>
            <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
            <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
          </configSections>
          <appSettings>
            <add key="webpages:Version" value="3.0.0.0" />
            <add key="webpages:Enabled" value="false" />
            <add key="ClientValidationEnabled" value="true" />
            <add key="UnobtrusiveJavaScriptEnabled" value="true" />
            <add key="SessionTimeout" value="6000" />
    
          </appSettings>
          <system.web>
            <customErrors mode="Off"/>
            <compilation debug="true" targetFramework="4.6.1" />
            <httpRuntime targetFramework="4.6.1" maxRequestLength="102400" />
            <httpModules>
              <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
            </httpModules>
    
          </system.web>
          <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
              <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
                <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
              </dependentAssembly>
            </assemblyBinding>
          </runtime>
          <system.webServer>
            <validation validateIntegratedModeConfiguration="false" />
            <modules>
              <remove name="ApplicationInsightsWebTracking" />
              <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
            </modules>
    
          </system.webServer>
          <system.codedom>
            <compilers>
              <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /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.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
            </compilers>
          </system.codedom>
          <entityFramework>
            <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
            <providers>
              <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
            </providers>
          </entityFramework>
    
        </configuration>
    

    .cs
    -如果更改非常小,您可以只上载DLL文件

    .cshtml
    -假设不修改相应的控制器,您只需复制并替换IIS中的单个文件

    您可能想看看WebDeploy,它只部署必要的文件,而不是整个应用程序

    我是否可以更改一些.cs或.cshtml文件以允许使用iis 是否重新编译而不是每次上载整个项目

    如果在记事本中打开
    web.config
    文件,只需单击
    file>Save
    或复制并替换相同的
    web.config
    文件,则IIS将重新编译应用程序


    注意:替换
    .cshtml
    文件不需要重新编译应用程序。

    谢谢!但是,我没有将其编译成.dll文件,我可以只更新.cs并重新打开IIS,还是使用IIS帮助我重新编译?通常,我们不会在已发布的应用程序中看到
    .cs
    文件。您正在尝试将整个源代码复制到IIS文件夹吗?您是如何发布MVC应用程序的?这不是我们部署ASP.NET应用程序的方式。右键单击web项目并选择
    Publish…
    ,然后选择
    IIS、FTP和web部署
    文件夹
    。如果您选择了
    文件夹
    ,则将编译后的代码复制到IIS。@junyu您是否能够部署应用程序,或者您是否仍然存在此问题?