Visual Studio 2015 MVC Project Template Access Denied - asp.net-mvc-5

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.
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:
Here's an image of the project settings in the "new" project:
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:
However, here is the same file in the new project created based off the template:
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?

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

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

Related

I don't see the Web.Debug.config and Web.Release.config files on my web.config after upgrading my project to VS2012

I just upgraded a Web Site project from VS2010 to VS2012 and I was looking into figuring out how to do what I used to do in the DeploymentPackage projects. There is a lot of good questions and answers I've read through on stackoverflow and I know what to do once I am able to find the files I need. For some reason my web.config doesn't have the two files underneath it (Web.Debug.config and Web.Release.config). I've installed the Web Platform Installer stuff and created my profile. I also created a custom configuration for deployment but I still am unable to see these files get created so that I can start changing some of my web.config settings on deploy time. Does anybody know if there's some setting/trick to get these files to show up in a migrated project?
If you don't see the files web.debug.config or web.release.config beneath the web.config file it could be because they are hidden. In the solution explorer panel if you click "show all files" they should appear.
I found the answer in a post here: how to add files in web.config transformation process?
In your "App Data" folder you'll find your publish profiles you created and can right click on them to add a config transform file.

VS2012 pubxml and TransformWebConfigEnabled

Maybe someone can advise me.
I am trying to publish a project using VS2012. I have setup a publish profile to publish it to a file system drive.
I have several environments/build configurations required and thusly am using Web.Config transformations.
At the moment, I have a web.config + 5 transforms (one for each build config). When the solution is published, it successfully deploys to the file system specified. However it also transforms the Web.Config into web.config.
I have modified the .pubxml to include the <TransformWebConfigEnabled>False</TransformWebConfigEnabled> element, but the publish process just seems to ignore it and transform the web.config regardless.
Followed via this link: http://msdn.microsoft.com/en-us/library/dd465342(v=vs.100).aspx
Can anyone advise?
[edit]
I have tried putting <TransformWebConfigEnabled>False</TransformWebConfigEnabled> element into both the pubxml and the proj file and both ways it get's completely ignored and the web.config is transformed regardless.
You are sticking it in the wrong file. You want to modify
YourProject.csproj
instead of PublishProfile.pubxml.

Where is MVC3's App_Code folder

This post contains a nicely succinct explanation for implementing razor helpers. But it refers to the use of the 'App_Code' folder - something i can't get my MVC3-transitioned-from-MVC2 project to create. I understand this has to do with WebSite vs. Web App but to be honest - i can't remember if the original creation was site or app. Since there's menu selection 'Convert to Web Application' seems it was created as a Web Site. But then there should be a App_Code dir, yes?
Attempting to recreate the steps from the original post (within a manually created 'App_Code' folder) presents pre-compile errors (MyHelpers does not exist in this context) - but the strategy _does work. - at least the simple hello stuff did. so i shouldn't argue with success? MVC3/Razor isn't fully intellisensed yet?
thx
I created an app_code directory by just creating a folder called app_code. MVC3 dealt with this file correctly by creating static methods for the code I put in there. When I reopened my solution later, the app_code file had disappeared. I eventually found that the app_code file was marked as a hidden folder by visual studio.
In this virtual machine I have the RTM VS 2010. not sure if this was fixed in SP1.

Missing safe control entry

I've got a working hello-world like webpart for my SPS3.0
I can compile, pack and deploy it using VS2008, makecab.exe and stsadm. So I know the theory of deploying sharepoint webparts.
My problem:
After I inserted an additional .webpart file, an elements.xml and a feature.xml to deploy the .webpart file and get knowledge about adding features to my webpart, the deployed webpart is missing its safe control entry in the web.config.
But the dll can be found in the gac and my features are also deployed to the right folders.
I didn't change anything in my manifest.xml especially not in it's -tag, because it definitely worked before i added my additional feature files.
Can anybody help me? Should i provide you some code snippets?
Thanks Stefan
You can try WSPBuilder, it will automate and ease your deployment process.
As far as I can tell, you are trying to find out how to register your web part as a safe control without using any tools, etc. and also without admin rights. I think you will find this impossible since the safe control registration needs to happen in the web.config file and one way or another (WSP Builder, manually, script) this file needs to be modified. Only admins can do this as far as I know.
If you are deploying your solution package using stsadm -o deploysolution, be sure that you are either using the allcontenturls parameter or that the url parameter is pointing to the correct web application. Which parameter you use (and how) will determine which web.config file(s) will have the safe control settings from manifest.xml applied to them.

Using SubSonic Active Record in a seperate assembly from the Web

I'm following the tutorial here.
I created a new Web Application. I then added two Class Library projects, Common and Domain. The common project contains the SubSonic library while the Domain project contains the SubSonic .tt and .ttinclude files.
After modifying the settings in Settings.ttinclude, I try to 'Run custom tool' on the tt files and I get this error:
Running transformation: System.ArgumentNullException: Value cannot be null.
Parameter name: The project does not contain App.config or Web.config file.
I can provide the rest of the stack trace, but it appears that it can't find my Web.config which was the connection string. Adding an app.config to the Domain project just causes the generation step to complain about not finding expected sections.
Is there a way to have these files in a separate assembly but still use the web.config for settings?
You need to place an App.config in the project you want to generate from. Yes, it's redundant but there's no other way to handle this with T4

Resources