I'm new to Windows Azure and just created my first "Web Site". Very easy and running well. 1 question though...
Does Azure ignore and/or override some or all settings that I have configured in my web.config file?
As a simple example, I have the following in my web.config:
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear />
<add value="index.html" />
</files>
</defaultDocument>
</system.webServer>
But I still see many possible default documents listed on the Configure tab for my site.
It got me wondering what other settings it is ignoring.
Thanks.
If you have a <clear/> line, I would not expect any of the default docs that you see in the Azure portal to actually be effective. What the Azure portal shows is what ends up going in ApplicationHost.config, which your web.config overrides.
Are you saying that you still see the Azure portal values being effective at runtime? That would be puzzling.
IIS in Windows lists several common default documents when you manage a site(home.html, index.php, etc). What you have listed in your web.config is not the list of possible default documents, it is the exact default document for your application. Azure is showing you common default documents in the configuration manager and will override your web.config if you choose something different.
Related
My wedding is coming up and I've printed 100 invites directing my guests to http://wedding.mydomain.com. Similar to a stand-alone project, I've set my startup page to my Default.aspx page as demonstrated here: http://blogs.msdn.com/b/zainnab/archive/2010/12/16/set-as-start-page-vstipproj0027.aspx.
However, when directed toward http://wedding.mydomain.com, I get a 'Maintenance' page. I have to manually go to http://wedding.mydomain.com/Default.aspx, to get the desired project.
Sounds like you might need to set the default document.
If you have an using IIS7(+) windows hosting you can set the default document in your web.config like
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="default.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
If you are using the Plesk interface refer to this article: https://support.godaddy.com/help/article/6853/changing-your-windows-hosting-accounts-default-file
I'm trying to add users to IIS Manager via web.config, but whenever I add the following lines, the web site stops working and says web.config is not valid.
The web site works if I add those lines in administration.config, but I like to keep the scope small by sticking with web.config.
<system.webServer>
<management>
<authorization defaultProvider="ConfigurationAuthorizationProvider">
<authorizationRules>
<scope path="/MyApp">
<add name="domain\user" />
</scope>
</authorizationRules>
</authorization>
</management>
</system.webServer>
A simple Google search can answer your question.
IIS Management element
From that page:
Note: The settings in the management element can only be configured in the Administration.config file.
We are working on a web application that creates more web applications.
Each web application will have to get a Url Rewrite rule (URL REWRITE MODULE 2.0).
As far as I know, there's no way to add such rules without modifying the web.config file (am I right??).
So my plan was to work with multiple web.config partial files. One main .config file, and lots of .config files per application (every file will contain it's web application url rewrite rules).
This way sounds a little bit messy, but I can't think of anything else, and suggestions will be welcomed.
So is it possible to use very-multiple web.config files for the root application?
Thanks in advance, Gal.
This following Tag will do the trick.
The absence of this tag was the main reason for my problem when i using with two web.config files for my two different application running in my website.
**<location path="." inheritInChildApplications="false">**
<system.web>
<!-- ... -->
</system.web>
**</location>**
Every application must have a full web.config and not partial, exept if you go with net 4
The trick is to use a lot the remove command on the other inside web.config and remove the parents setting that must not used on this.
For example if on the main root you have the a module that you do not won to use it on the other trees, you use the remove command on all other web.config to remove it. Especial the modules that are on one Bin and not on an other directory bin.
<httpModules>
<remove name="TheHttoModuleNotNeedHere" />
<remove name="AnonymousIdentification" />
... add here your other modules for that directory...
</httpModules>
The remove command is working for almost all sessions on config.
You can do make it work, I have done it, but its a lot of work to find all the conflicts/unnecessary configs and remove it.
For some other session there also the clear command. For example on role Manager you can clear all and add new.
<roleManager enabled="true" ...>
<providers>
<clear />
<add name="MyName" ... type="System.Web.Security.SqlRoleProvider" />
</providers>
Hope this help as tips to make it work.
I have an ASP.NET site where authentication mode="Windows". Just downloaded WebMatrix beta 2 yesterday, trying to debug my app.
In WebMatrix, I'm getting 401 errors after pressing F5 in Visual Studio. Also in VS, getting "Unable to start debugging on the web server. An authentication error occurred while communication with the web server." When I click the help button, MSDN tells me I need to enable Windows authentication.
I don't see an option for authentication in WebMatrix. This question is similar, but doesn't seem to apply for me (and no answer).
More info (not sure if this applies). I've enabled SSL in WebMatrix. VS is set up to use a custom web server with the URL of https://localhost:44300/routing/development.aspx. In WebMatrix, the URL in the request view is https://localhost:44300/routing/development.aspx/debugattach.aspx (not sure where debugattach.aspx is coming from).
I think I found the answer. Looks like Beta 2 (I haven't used Beta 1) has a lot of options that are not accessible via the UI.
In %My Documents%\IISExpress\config\applicationhost.config, at line 349 is
<windowsAuthentication enabled="false">
Changing "false" to "true" works for me.
Just got this working today. You'll have to edit the server's applicationhost.config file manually since there isn't any UI to it. This is located under your my documents/IISExpress/config/applicationhost.config.
Once you have this open in your favorite text editor, near the bottom you'll have to add a section of XML to setup your site to run with custom settings. The line above the </configuration> terminator, copy and past the following into your file:
<location path="SiteName">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<basicAuthentication enabled="true" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>
Make sure you change path="SiteName" to have it match the website's name in WebMatrix. Also make sure you change anonymous, basic, or windows auth to true or false depending on what you need your website to run as.
I have the same issue and am also looking for a solution.
Frankly saying, I wouldn't even imagine that this should work (especially after seeing Scott Guthrie link to article that tells to use macros for attaching to iisexpress process: http://www.intrepidstudios.com/blog/2010/7/11/debug-your-net-web-project-with-iis-express-t.aspx), but this used to work properly for me in Beta 1. So, one solution for you could be to go back to Beta 1.
try
<appSettings>
<add key="enableSimpleMembership" value="false" />
</appSettings>
I did a couple google searches about this and am not finding anything, so I thought I'd ask here.
I'm working on our internal CMS and I noticed that we're getting live data back when doing debugging because of our web services instead of the dev data that I wanted. It doesn't do this on our dev CMS website, but we're trying to do all our development on localhost. Is there any way to set up an environment variable in our web config for the URL so that the CMS points to the dev database instead of live database that is referenced in the wsdl files?
You can use the appSettings portion of the web config to for configuration information.
In the configuration section of the Web.config you will find the appSettings section:
<appSettings>
<add key="Key" value="Some Value"/>
</appSettings>
In code you can read in the value like this:
var someValue = ConfigurationManager.AppSettings["Key"];
+1 for Dan's method of storing the URL. To use this URL at runtime just update the URL property of your web service proxy object with the value from your web.config.
MyClientClass o = new MyClientClass();
o.Url = varFromWebConfig;
o.MyWebMethod();
Actually, one of my coworkers suggested an alternate way of solving this issue which seems even better to me: fixing it server-side, rather than client side like I've been trying and has been suggested here. His suggestion was to create a subdomain in IIS on all of our servers that points to the web service folder and then put host files for the appropriate web server on my local machine. This seems like the ideal solution to me since it wouldn't require changing all the current web service proxy objects like the client side solution would, just the web service consumption within App_WebReferences.
YES!!! USE Web.config transforms
Web.config contains the configuration that will run in your IDE while debugging:
<configuration>
<appSettings>
<add key="Service.Name" value="http://debugserverURI/Service.asmx"/>
</appSettings>
</configuration>
On publish in "Release" mode, transforms in Web.Release.config will be applied:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<!--point to production server -->
<add key="Service.Name" value="http://PRODUCTIONserverURI/Service.asmx"
xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>
</configuration>
You can do the same for Web.[whatever_build_you_want].config, if you support both test and prod servers.