How to define custom web.config in .Net Core 2 for IIS publish?

前端 未结 2 794
说谎
说谎 2021-01-19 05:40

VS will generate (and override) a web.config file as part of publishing to IIS. I have various items I need to include in the file (like extending the file upload max size l

2条回答
  •  爱一瞬间的悲伤
    2021-01-19 06:04

    I finally got back to this and wound up using a transform:

    1. Create a web.release.config file in the root of the project

    2. Set that file's properties to Build Action = None so it doesn't get copied directly to the destination folder

    3. Use the transformation syntax to define the sections that need to be inserted:

      
      
        
          
            
              
                
              
            
            
              
                
                  
                  
                    
                  
                  
                
              
            
            
              
            
          
        
      
      

提交回复
热议问题