We have an IIS 7.5 (not using ASP) with the following sites:
Site A
Site B
Site C
Site D
Site E
Site B, Site C and Site D belong to a centralized application that uses the same web.config. While the IIS allows us to use a web.confg for all of them plus an inherited web.config for each site, there does not seem to be an option to group sites to restrict this global inheritance.
To illustrate the problem, I will call the web.config after their content:
Site A uses web.config "company-website" in /www/static/site_A/web.config
Site B uses web.config "central-cms" in /www/cms/site_B/web.config
Site C uses web.config "central-cms" in /www/cms/site_C/web.config
Site D uses web.config "central-cms" in /www/cms/site_D/web.config
Site E uses web.config "community-board" in /www/boards/site_E/web.config
As you can see, we have 5 physical web.config files although 3 of them (B, C, D) contain the same content.
We want Site B, C and D to share a single web.config file, but still want Site A and E to use their own web.config without having to negate inheritance.
Possible structure:
/www/static/site_A/web.config (no inheritance)
/www/cms/web.config (base inheritance)
/www/cms/site_B/web.config (+ inheritance)
/www/cms/site_C/web.config (+ inheritance)
/www/cms/site_D/web.config (+ inheritance)
/www/boards/site_E/web.config (no inheritance)
Note: All web.config files declare various rewrite rules and directives for <system.webServer>.
Is IIS 7.5 capable of this?
The web.config should be capable of doing this actually. Put the common web.config file into a folder that each site has read permission for. Then modify the individual web.config files to call the common file:
<appSettings file="/path/to/some/common/web.config">
Then this common file can be used for any files that need it and ignored for those that don't. You can even rename it to common.config or something so that it doesn't get inherited. So this would work:
<appSettings file="/www/common.config">
All children directories should have read access to it, and since it's not a web.config it shouldn't mess with any application settings that are derived.
Note: When including a config file in this manner, changes to the included file do NOT trigger an application recycle in the same manner that a direct change to the web.config would. This should not truly be a problem since you simply have to restart the application pool, but it can be confusing at first.
Related
I created a web app on Azure. I am having issues adding additional html pages beyond an index. Is there something I'm missing? I've been searching to no avail.
Looks like you want to define your own start page name for the web app.
Files added to root path(aka wwwroot folder in kudu) can't be accessed with https://webappname.azurewebsites.net unless you set Default document in Application settings. Just add your file name in the list. The first matching file in the list is used.
If your page is deployed to a folder under root path, you also need to set Virtual applications and directories(also in Application settings). Change the physical path value from site\wwwroot to site\wwwroot\foldername.
I have an asp.net project that I use for a couple different purposes. We have addresses that access the same virtual directory via different paths (use1.company.com and use2.company.com) I do not want to break the project up as they use similar functionality that seems redundant to have in two places. None the less as it stands use1.company.com/default.aspx and use2.company.com/default.aspx both are the same. I want to make it so that use2.company.aspx/default.aspx is not accessible. Is there a way to do that from the App Pool/Virtual Directory settings or do I just have to hope that external users dont type /default.aspx?
I know I can set the default document to like survey.aspx (purpose of the second url) but that does not prevent some savvy users from typing in default.aspx just to see what it does. Any assistance here would be great.
Since they point to the same .aspx file could you not include an if statement at the start of the file to grab the URL and if it includes use2 then go back?
I am trying to find out how to host an ISAPI DLL in Azure. In addition to the DLL, I'll need to deploy supporting files in subdirectories (javascript & css files). And two of these subdirectories can have their contents changed by requests handled by the DLL, so I need to ensure that the account executing the extension has write permission for these.
It would seem that the key to all of this is using a startup task to call appcmd to script all the IIS changes somehow, and I think I need to do the following:-
Deploy my ISAPI DLL and supporting files with my ASP.NET website
Create a startup task which will call a batch file utilizing appcmd.exe to do the following:-
Create a dedicated app pool with its managed pipeline mode set to Classic, and using a known user account
Create an IIS application pointing to the directory where my ISAPI dll resides
Ensure the application is configured to allow unknown ISAPI extensions
Alter the permissions of the required subdirectories so the user account associated with the app pool has write access
I've only just started exploring Azure, so my experience with it is very thin on the ground. Is what I'm hoping to achieve actually achievable? And if so, am I on the right track with regards to the steps required? They mimic what I need to do if I'm setting up this ISAPI DLL in the traditional IIS environment I'm used to dealing with, but please let me know if the rules are different with Azure.
Looks like a good sequence, however, the startup tasks actually run before IIS is completely configured. The 'OnStart' event in the RoleEntryPoint is called after IIS is set up, so it's probably easier to use the IIS application that Azure creates for you, and reconfigure it to include your ISAPI stuff.
Well the only thing bothering me here is that you're modifying data on the 'deployment drive' (E: for that matter). You shouldn't be doing this.
Instead, think of an other solution. You could create a LocalResource holding your javascript and CSS files. Then, when your role starts (Richard has a valid point about startup tasks), use ServerManager class to do the following:
Register the ISAPI dll
Add 2 virtual directories under the website created by Azure and point them to the LocalResource.
Modify the code of your ISAPI dll to modify JS/CSS files in the LocalResource
When developing in Web/WorkerRoles, you need to keep in mind that you should only manipulate files in a LocalResource.
I use NLog for logging and now I'm trying to also use it for my SharePoint solution.
How do I instruct WSPBuilder to include NLog.config in WSP and place it in the same folder as solution dll?
EDIT:
Okay, another option is to put it as Web.nlog in SharePoint 80 directory.
Do I need a separate feature for this? What should I write in elements.xml?
I don't think this can't be done - I assume for security reasons.
DLLs can only be deployed to GAC (signed assemblies only) or to the bin directory of the web application (deployed via the solution manifest, along with any required CAS policies).
If you want extra files alongside the assembly in the bin directory, you'll need to copy them manually.
Does NLog.config need to be a separate file, or can the settings be integrated into the web.config file? If you can integrate the settings into the web.config file, you can add a feature receiver and write the necessary settings during the FeatureActivated or FeatureInstalling event to web.config using SPWebConfigModifications (just google for it). You should also make sure to remove the settings in FeatureDeactivating or FeatureUninstalled event.
You should also take a look here :
http://msdn.microsoft.com/en-us/library/ee413935.aspx
I would also ask these questions :
Is the configuration the same for all the farm ? Only one web application ?
Can you programmaticaly specify NLog configuration ?
Depending on your answers, I will suggest one or more solutions.
The disadvantages with the web.config are
Configuration is deployed on all SharePoint servers (the feature take care of that, but you have to keep that in mind in case of inconsistant behavior)
If you want to modify settings there is no easy way
Each time you modify settings, it will recycle application pool.
my shared hosting only allows me to create 2 virtual directories. and i want to host multiple webapps... say an asp.net mvc blog, a forum, a personal site etc...
isnt there any other way of doing this? cant i simply just ftp the blog folder to one of my virtual directories and then access it online??
For ASP.NET web applications, typically each would live in its own virtual directory which serves as the application starting point.
Technically you could "piggy-back" two applications on the same application starting point in one of two ways:
Put all the files for each application in the same directory (and appropriate sub directories)
If you don't have ANY files that overlap, you can get away with this. Of course, it's likely that you won't with such files as the default or index pages, etc. And this would be pretty messy anyway.
Put all the non-binary files for each app in an appropriate subdirectory and the binaries in the main virtual's \bin directory.
You'll be able to do this only if each application's binary files don't overlap by name AND there are no namespace ambiguity conflicts between assemblies (two different assemblies by file name, but with the same namespace). The latter is much less likely to happen if you are trying to piggy-back two different applications.
The big problem I see with the latter solution is that any parts of the application that make use of application root references will break. When some code tries to resolve a reference to some resource (like an image) based on an application root reference such as
~/images/logo.gif
the ~ will get resolved to the virtual directory, but will not include the additional (non-virtual and non-app starting point) subdirectory in which the application lives. So instead of this:
/vd1/app1/images/logo.gif
you'll end up with this:
/vd1/images/logo.gif
Obviously, that won't work.
So... you won't break either app if you can put them both in the same virtual directory, however, you'll have to check for file conflicts and such. Possible namespace conflicts will be unavoidable without separate application starting points.
Can't you just put each app in a separate subdirectory in either of the virtual directories. e.g. if you had http://server.com/vd1, you could partition it like http://server.com/vd1/app1, http://server.com/vd1/app2, etc.