web config error running asp.net app on Azure App Service - asp.net

I am very new to Azure and have deployed a .net application to an Azure web Service over FTP and am getting the below error in the web config at the top line of the section below:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.
<authentication mode="Forms">
<forms loginUrl="~/Account/Logout" defaultUrl="~/Home" timeout="120" slidingExpiration="true"/>
</authentication>
I have searched online and problem seems to generally come when there are multiple web configs, which isnt the case here. Is there something specific I need to configure in Azure? The application runs fine on local web server.
For additional information the application is in a sub directory in the root and I have added a virtual application in the Azure app portal for the root directory of the application.

Related

Several asp.net apps in single Azure App Service

I got two working asp.net projects - API and site itself. I am trying to deploy it to one instance of Azure App service. But I got working configurations only if I deploy it to app's subfolder, and create non root virtual applications, e.g.:
But if I am trying to make root app for site:
I got problem with API project - it fails to work, cause it is trying to load Web.config from 'root' virtual application:
How could I made virtual app to load its own config file - not from the root app?
You can use inheritInChildApplications in your application(not api) web.config to stop inheritance.
Wrap system.web section with location element with inheritInChildApplications set to false
<location path="." inheritInChildApplications="false">
<system.web>
…
</system.web>
</location>
You can read more about it here

WCF IIS Error 403

I am reading the book WCF 4.0 Multi-tier Services Development and tried implementing a simple Hello World with WCF using IIS.
I have a HelloWorldService project and a HostDevServer project (Startup Project). I should see a directory listening with two files but instead I get the next error message:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Most likely causes:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
What I have done:
Enabled Directory Browsing in IIS manager
Checked if I had Default Documents, they were present.
Run command: appcmd set config /section:system.webServer/directoryBrowse /enabled:true
In the about screen in IIS it says version 7.5 and in the browser it says "IIS 8.0 Detailed error ...". I don't know if this has something to do with the problem.
I use Visual Studio 2013 for development. Web.config below:
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
Does anyone know how to solve this problem?
I suspect you try to host the WCF as it was hosted with the self-host - under an extensionless uri.
This won't work. WCF services are hosted under *.svc activators. The extension informs IIS that it should find a proper host factory and create the service.
I added the website to the IIS manager and now it is working. I did need to edit permissions to acces the files but now i can acces the page without problems.
Should have read further in the book because they also explain about *.svc activators later.

Windows Server 2008 publishing ASP.NET

I installed Windows 2008 wo/ Hyper-V to my server. I configured IIS 7 and start publishing HTML pages successfully. But when I want to publish (ASP.NET/C#) web site, I faced with an error which is;
' 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.'
Error line is; <authentication mode="Forms"> . I configured IIS server and enables Forms authentication at authentication form, but still I cannot reach my web site. What can be the problem?
Thank you,
Jack Smith.

IIS7 -- 401.2 Error with Forms/Anonymous Auth Enabled

I have installed an ASP.NET 4 Web Forms app on a remote Win2K8R2 virtual machine. I cannot remotely deploy anything to this box, so I shipped a VS2012 Web Deployment Package which I installed locally. I installed the IIS Recommended Configuration through WebPI 4.6.
I started out using the Default Application Pool (mine will be the only web app on IIS) in Integrated Pipeline mode with LocalSystem identity. This is the exact same configuration that I successfully have used for other web apps on a Win2K8 VM and a Win2K8 physical box.
I am using Forms/Anonymous Authentication. The Account directory Authorization is configured this way:
My application Authorization is configured like this:
UPDATE:
My application Authentication is configured like this:
My Membership Provider is configured like this:
<membership defaultProvider="ActsMembershipProvider">
<providers>
<clear />
<add connectionStringName= [myString]
name= [providerName]
type= [assemblyName].[providerName] />
</providers>
</membership>
My Forms Auth is configured like this:
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="~/Account/Login.aspx" defaultUrl="~/" protection="All" timeout="30" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" />
</authentication>
UPDATED: After searching SO, here's what I have tried:
Re-registering ASP.NET with IIS. (aspnet_regiis -ir)
With IUSR as Anonymous Authentication user, granted full web app directory rights to IUSR.
Switched App Pool identity to NetworkService and granted app directory rights to NETWORKSERVICE.
Switched Anonymous Authentication user from IUSR to my server username (xxxx/s_usr_acts, as shown in previous screenshots) and gave s_usr_acts full rights to web app directories.
aspnet_regiis at the app level.
I can reach my Login page, but I keep getting the 401.2 error when I try to log in. Anything else I can check or try?
Additional Info:
UPDATE: I have this same application successfully configured on a Rackspace Win2k8 production box and an in-house Win2k8 VM.
I am authenticating via the ASP.NET Membership Provider.
I am running EF5 against Oracle's Data Provider.
UPDATE2: When I ran my Web Deployment Package from root of the C: drive on our client's server, I encountered the 401.2. However, when I ran it from the Desktop, I no longer encountered the 401.2, and "progressed" to Oracle connection errors. I have this as an answer because my findings addressed the specific problem, although I don't consider this canonical in any way. I am still hoping for something closer to a canonical answer.
I had the same problem and I solved it when changing Anonymous Authentication Credentials at IIS Authentication panel. When I selected "Aplication pool Identity" the error dissapeared. I don't know why this is the solution. Although I don't know what is the origin of this mistake neither, because I only wanted to update my web application copying the files from the deploy folder except the web.config file.
Now, after putting out fire, i'll investigate why it happens. For the moment i think that can help somebody.

ASP.NET MVC3 401.1 Error in IIS7.5

I have setup an ASP.NET MVC3 website using Windows Authentication and am getting a 401.1. The error code is 0x8009030e on the 401 page. Users should be able to access the site using their domain credentials.
I don't get the error if I logon to the machine and hit the website via localhost (http://localhost/mysite). However, even logged onto the server, if I hit the website through the server name (ie http://machinename.com/mysite) I still get the error.
The website uses it's own .net 4.0 app pool and using integrated mode. The site is configured for Windows Authentication only in the config.
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
...and in IIS. I don't have extended properties configured, and have enabled kernel-mode authentication (both are the default). I've tried toggling "IIS Manager Permissions" without any luck.
Any ideas?
I had to do two things to get this working properly:
Make the app pool use "Classic" instead of "Integrated" mode. After making, the change I was getting a 403.x error.
I solved the 403.x error by granting (Read/Execute) NTFS permissions to the "Domain Users" group.

Resources