12

I trying to deploy my ASP.NET WebForms application to AppHarbor. After a succesful deploy I get

The directory '/App_GlobalResources/' is not allowed because the application is precompiled

I disabled the Precompilation in the app settings but it did not help. What should I do? Should I change some settings in my project o is it a server configuration thing?

I found a solution deleting the PrecompiledApp.config but I do not have access to it on AppHarbor.

Igor Kulman
  • 16,211
  • 10
  • 57
  • 118

2 Answers2

23

All you need to do, if your site is Precompiled, is to make sure that the directory /App_GlobalResources is deleted from your deployment location.

I had the exact same problem, and when I removed this directory it all worked very well.

NOTE: Its good to have your site precompiled so it is faster and more responsive, and therefore it may not be a good idea to remove precompiledapp.config file from your deployment folder.

Sunil
  • 20,653
  • 28
  • 112
  • 197
  • How to make the publish not to publish the /App_GlobalResources folder? – Jeff Tian Nov 27 '14 at 06:17
  • 3
    Yes, it can be excluded. View the first 2 FAQs at this MSDN link: http://msdn.microsoft.com/en-us/windows/ee942158%28v=vs.71%29.aspx. Or simply do this: In web app properties go to Package/Publish Web tab and select 'Only files needed to run this application' AND then make sure all resource files under this folder have their Build Action to 'Embedded Resource' and also 'Do not Copy' is selected for these resource files under 'Copy to output directory' property. – Sunil Nov 27 '14 at 07:59
  • After I marked the resource files under App_GlobalResources folder 'Embedded Resource', they are inaccessible due to protection level, do you know how to fix it? – Jeff Tian Nov 28 '14 at 03:27
  • @Jeff, You should be able to edit it in Visual Studio, but you cannot edit it in deployed web app. – Sunil Nov 28 '14 at 17:23
  • thank you I have changed default Customer Tool to `PublicResXFileCodeGenerator`, and now it worked! – Jeff Tian Dec 01 '14 at 02:55
  • @JeffTian This does not work for me, the `designer.cs` will be empty with that Customer Tool. – Martin Braun Jun 12 '16 at 00:31
  • The same problem occurs in Azure as well and this solution fixes it too. – mcy Oct 26 '17 at 12:56
0

The trick is not only to disable the Precompilation in the app settings but also to deploy a new version so the app gets restarted.

Igor Kulman
  • 16,211
  • 10
  • 57
  • 118