6

I've created a very simple MVC application in VS2015 which has some basic CSS styling and some HTML to get an application off the ground more quickly.

The application runs perfectly.

I've exported this as a template using File -> Export Template...

I then created a brand new project based off this project type. So far so good. But, now when I run the newly created project I get a blank page with "Access Denied" (see image).

I've been going over the template project and the new project with a fine tooth comb and I can't find any differences. Why would one work but the other give an access denied? I am out of ideas, any help is appreciated.

Access Denied

EDIT:

After more research I have found the cause of the problem, but not a solution.

It seems that the project template has "Anonymous Authentication" as Disabled, and has "Windows Authentication" set to Enabled in the project settings. However when I create a project based on the template these values are flipped and thus causes the Access Denied.

Here's an image of the project settings in the template:

enter image description here

Here's an image of the project settings in the "new" project:

enter image description here

Note that both Authentication settings are flipped. Can anyone tell me how to get this to not happen?

Edit 2:

As suggested, the applicationhost.config files are different which is causing the above problem. Here is the applicationhost.config security section of the Template:

enter image description here

However, here is the same file in the new project created based off the template:

enter image description here

Notice that the section is missing entirely from the new project. So, now the question becomes how do you get this to copy over to new projects?

BrianLegg
  • 1,658
  • 3
  • 21
  • 36
  • 1
    I'm not sure. But maybe it's related with applicationhost.config. Seems that you're using the same port for both applications. Could you check physicalPAth attribute on section of your applicationhost.config file? Maybe it's trying to access to the first project instead the new one. – Carlos Fernández Apr 25 '16 at 12:28
  • I think you are on the right track. The section seems to be the same, however the security portion is different. See my updated question for more details. – BrianLegg Apr 25 '16 at 17:55
  • I cannot reproduce your problem on my computer. But seems that the applicationhost.config is not referenced in the template zip at all. Can you check what is in your applicationHost.config template? http://stackoverflow.com/questions/31713624/where-is-the-template-for-applicationhost-config-file-stored . I'm guessing but maybe the template configuration is obtained from that file (Not sure at all, just trying to help) – Carlos Fernández Apr 26 '16 at 09:57
  • Carlos - you've gotten me closer to the solution than anyone else. If you want, could you compile your comments into an answer and I will award you the bounty. Thanks again – BrianLegg Apr 29 '16 at 19:52
  • Yes, sure. Thank you – Carlos Fernández Apr 30 '16 at 15:39

2 Answers2

1

As suggested by BrianLegg I move my comments to an answer

Seems that the problem is related with the applicationhost.config file. This files it's not present on the zip file which contains the template.

You could take a look on the physical path attribute on

 <system.applicationHost>
          <sites>

Maybe it's trying to access to the first project instead the new one.

Could you check what is in your applicationHost.config template?

Take a look on Where is the template for applicationHost.config file stored

Community
  • 1
  • 1
  • Carlos - I've marked your suggestion as the answer, but the bounty expired before your post. I can't seem to award it now. Sorry - this was my first bounty. – BrianLegg May 02 '16 at 12:56
0

have you had a look at the global routes? it could be something routes not created or corrupted?

Baahubali
  • 4,604
  • 6
  • 33
  • 72
  • I'm not sure what you mean by "corrupted", but the RouteConfig and web.config are identical. In fact, I can't seem to find any differences between the two projects other than their behavior. Thanks for the suggestion – BrianLegg Apr 20 '16 at 13:38