I currently am attempting to create a UI Module for IIS. I plan on using it on IIS 7 and up.
I have followed several different tutorials.
I used the source from this link for testing after it failed to work the first time.
Creating a UI Module For IIS7 to watch Current Requests
I did more looking here
How to Create a Simple IIS Manager Module
My end goal is to have a button within IIS (as it is in the first link).
I am getting the assembly into the GAC (%windir%/assembly), I checked that.
I then added
<add name="CurrentRequestsUI" type="CurrentRequestsUI.RequestModuleProvider, CurrentRequestsUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=269f1cc1a4bf892b" />
within the moduleProviders section of my administration.config (%windir%/System32/inetsrv/config)
then added <add name="CurrentRequestsUI" /> in the modules section of the same file.
Right now I'm just using sample source to see if I can get that to work before I start my project. I apologize for if I'm posting this in the wrong place. If you want me to provide more information, ask and I will provide it.
My question is how do I add a custom UI Module to IIS?
Thanks in advance for the help!
I had been editing the administration.config file within Visual Studio and Notepad++ (32-bit applications), but I then opened the 'same' file within Notepad (64-bit application). Making changes within Notepad made the changes within the proper file.
Opening 32-bit applications such as Notepad++ and Visual Studio 2010 opened the wrong file
%windir%/SysWOW64/inetsrv/administration.config
Opening 64-bit applications such as Notepad opened the correct file
%windir%/System32/inetsrv/administration.config
Related
My (C# Asp.net) website works locally, but when I publish it to Azure, it is missing a dll (OpenXML SDK).
After extensive googling, I found that I should set the Copy Local property to True. The thing is though, there is no references node in my solution explorer. Even if I create a new project, and add a few references, there is no references node there. (MS Visual Studio Express 2013 for Web)
Here is the error:
Parser Error Message: Could not load file or assembly [...] The
system cannot find the file specified.
The error is caused by this line (in my Web.config file):
<add assembly="DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Please help me to either:
display the references node
or manually upload the needed dll (feels odd)
or add some magic command to my Web.config to make it automatically upload the used dll-s.
The references node was missing from my Solution Explorer because I chose to create a Web Site, not a Web Application. For Web Sites, the actual physical folder structure is what gets synced to the server. It doesn't have a References node (and, by the looks of it, many other things are missing, since the basic idea is bit different - see this discussion for more details).
There were two solutions for the problem:
Converting my Web Site project into a Web Application project (instructions here)
Adding a Bin folder in my project folder (that is the folder with the project name, the on that has my .aspx files in it), and including the necessary dll in that folder
I chose the latter. After publishing the site again, Visual Studio automatically uploaded the Bin folder with the dll inside it, and it worked like a charm.
I've created a small Class Library, with a HttpModule that uses a filter to add some html to every requested page served by IIS7.
I tested it first by registering the module in the web.config in a test web site, and it works as it should, but only in that one application.
I generated a dll, and created a strong named assembly.
I need to somehow add this assembly as a module in IIS on a server level, so that it works for all requests, on all applications, and for non-asp.net content as well.
So far, I have tried adding the .dll as a native module. This doesn't work. It's on the list of native modules, but it doesn't work.
I have installed the .dll in the GAC.
Reading on, it seems I have to add the assembly as a managed module, and then choose it in the dropdown list under "add managed module" in IIS.
For this, I tried using the commandline tool appcmd, writing: "add module /name: string /type: string /preCondition: string"
I've had no success doing this, since I can't figure out what to set as type and precondition.
As I have read, the modules registered in IIS should work for all applications in all sites, and all requests.
The point is to avoid having to register the module in every applications web.config file.
Any ideas?
After working with this for a bit, I managed to make it work.
Installing the assembly in the .net 4.0 GAC will not make it available in the type dropdown in IIS manager under "Add Managed Module".
What I had to do was:
Create the .net 4.0 Class Library, and compile it as a strong named assembly
Install it in the .net 4.0 GAC by using the gacutil, located in Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools
(Or make Visual Studio compile, sign and install the assembly automatically)
Add this line under <modules> in applicationHost.config: (it has to be done manually, it can't be done in the manager)
<add name="MyName" type="NameSpace.ClassName" preCondition="managedHandler,runtimeVersionv4.0" />
This makes the module run on requests to sites developed in .net 4.
It appears, however, that requests to sites developed in pre .net 4 versions can't use a module created in .net 4.0. So if you make requests for pages in a site created in .net 3.5, the module will not work.
Another observation:
After you have added the module to IIS via the applicationHost.config file, if you open the IIS manager, highlight the servername in connections and click modules. You will see the .net 4 module on the list.
Double click on it, and you'll then see the settings for it. You'll see that the "Invoke only for requests to ASP.NET applications or managed handlers" checkbox is checked. If you uncheck it, and hit ok, you'll get an error saying that the assembly hasn't been installed in the GAC.
But didn't I just install it succesfully in the .net 4 GAC? And didn't I just see the module run in a request?
If you go ahead and save the settings anyway, you get a runtime error, and if you look in applicationHost.config, you'll see that your previously manually added module settings has changed.
But what if I want to "Invoke only for requests to ASP.NET applications or managed handlers?
I am now able to run the module on every request. The reason it didn't work before was a totally un-related error on my part.
So, the steps involved to make it work is:
Write the code you want to run on every request, as a .net 3.5 Class Library.
Compile it as a strong-named assembly.
Install the assembly in the GAC.
In IIS7 manager, select the server name in connections, click Modules, click "Add managed module" in actions.
write a name for the module and choose your newly installed assembly in the type dropdown.
Make sure the site uses an application pool running in integrated mode.
Of course, it's not always a good idea to let all code run on all requests, so you may need to filter some of the requested files.
One question remains though!
There are now two GAC's, Microsoft.NET for .net 4.0, and Windows GAC for pre .net 4.0.
Because I created my assembly in .net 3.5, it was installed in Windows GAC, and therefore it was available in the type dropdown in IIS manager.
When I created my assembly in .net 4.0, it was installed in the Microsoft.NET GAC, and as a result, it was NOT available in the type dropdown in IIS manager.
The question is: How do you add a .net 4.0 assembly as a managed module in IIS7, and have it run like my 3.5 managed module?
This must be possible, right?
You have to add a module at a server level. You can do that from command line:
appcmd add module /name:string /type:string /preCondition:string
To get command line help execute: appcmd add module /?
In short, it must look like:
appcmd add module /name:AnyNameOfYourChoice /type:YourClassNameSpace.YourClassName
/preContition parameter is optional.
More details here.
OR
Do it from IIS Manager by going to server node -> Modules -> Add Managed Module
More details here. (bottom of the page)
I'm having a problem in Visual Studio 2008 ASP.Net where I used the ReportWizard and created a bunch of Reports with .rdlc extensions, it also created a dataset for each report. In my page I use the "Microsoft Report Viewer", when I run the computer in my machine, the reports work. But when I use the option "Build->Publish" and someone on the same network as me, tries to use the page reports it says:
Server Error - 404 File or directory
not found - The resource you are
looking for might have been removed,
had its name changed, or is
temporarily unavailable.
I could solve similar problem (worked on dev machine, but not web server) by using the info from http://forums.asp.net/t/1497749.aspx/1 .
In web.config, add the following under <handlers>
<add name="Reserved-ReportViewerWebControl-axd"
path="Reserved.ReportViewerWebControl.axd" verb="*"
type="Microsoft.Reporting.WebForms.HttpHandler" resourceType="Unspecified"/>
Are you able to run the published report. If yes, it is probably a rights issue, even though the error message is file not found.
where are you publishing these files? remember that rdlc are designed to run on the client side this means the definition file and the dataset need to live on the client. if you want to use SSRS you need to specify RDL files and not RDLC
I have an ASP.NET application which I'd like to try running on Mono, just as an experiment. When I bring the application as it is to Mac, start xsp2 on the directory, it runs as I would imagine it should. That is, it crashes on because of the file system path differences (\ vs / in directories).
This is where I would like to open it in MonoDevelop and fix the problems. But since it was website, it doesn't have .csproj file. And it seems that there's no .sln file either, since Visual Studio stores those to some random directory by default. In Visual Studio you could open the project with Open -> Web site... -> Local IIS etc., but I see no such thing in Mono.
Is there a way to open a directory as a web site or somehow generate the .csproj file? I would prefer an answer which won't need Visual Studio or even Windows to help me with that.
Create new project in MonoDevelop in the same directory as your files.
Right click the project in the solution window
Choose Display Options -> Show All Files
Right click a file and choose Include to Project
You can select multiple files at a time (shift or ctrl click) and include them all at once, or include full directories.
Unfortunately you can't open WebSites in MonoDevelop. WebApplications are supported in MD, but WebSites aren't. Michael promised yesterday that he will explain why, you can ping him to touch this topic quicker.
Some more information is available:
http://mjhutchinson.com/journal/2008/08/15/web_application_projects_md_and_vwd
http://mjhutchinson.com/journal/2007/06/04/rethinking_asp_net_project_models
http://mjhutchinson.com/journal/2006/06/10/asp_net_project_models
Probably, in the long run, the best solution for you will be to migrate from WebSite to WebApp.
One option to avoid changing your application settings is to use Mono's built-in path remapping feature, basically do this:
$ MONO_IOMAP=all
$ xsp2
For more details you can read:
http://www.mono-project.com/IOMap
Create a new project in MonoDevelop and import the files into it.
Today I stumpled upon the shadowCopyBinAssemblies option in the hostingEnvironment tag.
Appearently this attribute it is a web.config (system.web) configuration Boolean option indicating whether the assemblies of an application in the Bin directory are shadow copied to the application's ASP.NET Temporary Files directory.
<hostingEnvironment shadowCopyBinAssemblies="false" />
A colleague had to enable this setting because (only) on his development machine he frequently got that ASP.NET error in the web browser:
Cannot create shadow copy assembly file dll when that file already exists.
compiling a specific web project in Visual Studio 2008 and openining a page.
So now my question: can I preserve this setting in a production environment or could it harm performance and/or create other issues?
Thanks!
I get this error from time to time, and usually doing Clean Solution followed by Rebuild Solution takes care of the problem. If this works for your colleague, then there's no need to play with the setting (especially in production).