Web Deploy and Asp.Net MVC 3 Error (Error to Use Section Beyond Application Level) - asp.net

I've got a Visual Studio 2010 MVC 3 Project that I'm trying to deploy using the Web Deploy Publish option from within Visual Studio. Whenever I try to deploy I get the following error:
It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS.
When I google the above error I find that people say to either configure the virtual directory as an application, or to check for nested web.config files.
The site runs fine when I deploy the project to it manually, so I believe the site is configured properly. I don't have an application below the site tho, as the site itself is set up as the application.
Also while MVC projects do have nested web.config files (one in the root and one in the views folder) renaming the views web.config file didn't fix the error.

Have you tried deleting your complied code in the obj folder and re-compiling?

Related

Difficulty with Converting a WebSite to Web Application and Testing

This is not as straight forward as I had hoped.
I created a Web Site project on my development machine using the Visual Studio C# template for a WebSite Project. (Visual studio 2010 .net 4.0). The project name is C:\Nova5\WebSite3. It consists solely of:
the Bin subdirectory
Nova.svc file
web.config file
It has been tested to run correctly by:
Setting the website as the startup project, then
Run Debug-->Start Debugging
When tested, the NovaDataService information page is correctly displayed. It also correctly works when used through my client project.
I followed the recommended procedure described at
Walkthrough: Converting a Web Site Project to a Web Application Project in Visual Studio to covert the Web Site to a Web Application.
I now have the following problems and/or difficulties:
If I use the recommended procedure for testing the web site:
-- File | Open | Web Site
-- Build Web Site -- Start Debugging
I get the Error: The type 'Nova5WCFServiceLibrary.NovaDataService', provided as the Service attribute value in the ServiceHost directive, or provided in
the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
Since, I think, the WebSite does work, I skipped this error and moved on to the next part of the article. The next issue (?) is there is no App_Code file in the WebSite. Is this necessary? If it is necessary, how should I create it? Or do I need to create another WebSite project from its template just to have it?
I did not copy the Nova.svc nor the web.config from the WebSite to the Web Application as none of the references I read indicated to do so. Should I copy these files to the Web Application as well?
I now used the "Convert to Web Application" on the Web Application project and recompiled the solution. Everybody is happy. No errors reported. So how do I now test the Web Application project on my development machine (which also has the client application) ?
TIA

Already deployed asp.net web application wont run in different machine

I am trying to run an already-deployed ASP.NET web application on a different machine, but I am getting a machine-to-application error. I am a beginner to ASP so please help me out with this.
This is the error which I get:
"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS."
This is an error that is received when you deploy the application to a folder that is not marked as an application in IIS and you have a configuration setting that only works at the root application level. You don't have to do anything with the application, this should completely be an IIS setting. Right-click on the folder in IIS and select Convert to Application and choose the Application Pool appropriate for your application's framework version.
Turns out that the VS was complaining about a configuration section within the web.config file in the Backup folder application...just remove the backup folder so it doesn't have a web.config file under the Virtual directory that your ASP.NET application is running in.
Hope this will help you,
for more detail go through
http://forums.asp.net/t/1031775.aspx?Configuration+Error+allowDefinition+MachineToApplication+beyond+application+level

Have to specify Assembly name for all class references

VS 2010, .NET 4.0, VB, EF 4.4
I was having issues deploying my web application to the server... was getting the error "Could not load type " when I tried running it on the server. Googling around I also found that my Web App should not have an "App_Code" folder (copied over shared but of code from other corporate Web Sites). So I moved all the classes from App_Code to a folder off the root ("BLL" - also the namespace of our code library).
Now when I run the app in the VS IDE I'm getting the error "Configuration Error. Could not load type 'BLL.Roles'" coming from the load of the web.config. If I add the assembly name of the app to the front of the "BLL.Roles" > "appName.BLL.Roles" I get past this line and error out at the next reference to "BLL".
I've Cleane and Rebuilt my project.
Why are my classes not getting recognized as part of the app?
I could be wrong but i believe because you are using a Web Site and not a Web application you can only access classes that live in the App_Code Folder. If you are working with a Web Application you can access classes no matter what folder they live in. In that case you might have to move your files to a new project that is under a Application format and not a Web Site format. I would try to move your files to a Web Application project.

ASP.NET - Change from Web Application Project to Web Site Project

I am new to Visual Studio and ASP.NET. I have a MyClass.cs file under App_Code directory, but could not able to run the function in the class file. Keep getting this error:
The name 'MyClass' does not exist in the current context
I know that code works fine since I posted the codes and others confirmed it works, but I am still receiving the error above.
I read alot more threads on the NET and somes indicated that problem is using Web Application Project instead of Web Site project, which the class file would not compile. I am not sure if I've created it under Application Project we Web Site project.
How can I tell that my site is running under Web Application Project or Web Site Project? and How can I change it to Web Site Project so my class can be recognized.
Thanks in advance,

Web Deployment Project With Nested Applications

I have a web application that I'm trying to create a Web Deployment Project for in Visual Studio 2008. My application also has a child web application. Both are web applications in IIS. I have added the Web Deployment Project so that I can automate the build process for this application. When I try to build the Web Deployment Project, I get the following error:
Error 639 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
It's the child web.config that the error is referring to. I've tried to find a solution on the web and while this seems to be a common error, neither of the two suggested solutions seems to fix my problem. The first solution is to make sure the application is an application in IIS which both of mine are. The second is to make sure there are no child web.configs anywhere in the solution. I have a child config but it is part of the child web application and cannot be eliminated.
Is there a way to get the Web Deployment Project to build with an application structure like this? If not, is there a way to automate building .Net web applications using MSBuild without a Web Deployment Project?
Found the answer here Specifically, if you have nested web applications, you need to enable the "Use IIS metabase path for source input" option in the Compliation section of the Web Deployment Project Properties. That will cause only the root application to be built. The default is for the Web Deployment Project to build all applications including children.

Resources