Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 MVC Project Template Access Denied

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?

like image 744
BrianLegg Avatar asked Apr 19 '16 19:04

BrianLegg


1 Answers

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

like image 134
Carlos Fernández Avatar answered Nov 04 '22 15:11

Carlos Fernández