I've installed IIS7 on my workstation and enabled IIS6 compatibility so I can test classic asp pages (for some old projects here at work).
Some pages work, but others don't.
I receive:
Serverobject error 'ASP 0177 : 800401f3'
Server.CreateObject failed
/master.central.be/master_connection.asp, line 55
800401f3
On that line i've got:
Set dicTalenLabels = Server.CreateObject("Scripting.Dictionary")
Anybody got some ideas what todo to fix this?
Edit:
As suggested by Michael Pryor, i've ran a vbscript with similar code and it was succesful. So it probably has something todo with permissions. Currently trying to figure out which files exactly...
Do I need to add IUSR to scrrun.dll? When trying, I do not have permission, although i'm a adminstrator.
Edited: He's running 32 bit vista, so it's definitely not a 64 bit issues.
Make a test.vbs file and put this in it
Dim o: Set o = CreateObject("Scripting.Dictionary")
Then run it like so
cscript.exe test.vbs
Does it give you the same error?
If it does, then the regsvr32 is failing or something is wrong with the registry keys it would normally put in the registry.
If it doesn't fail, it's likely that the user you have running your asp page (by default it is IUSR_machinename) doesn't have permissions on either ther registry keys it needs, or the actual .dll
0x800401f3 means that the "Scripting.Dictionary" is incorrect or not found. The Scripting.FileSystemObject is provided by the same dll file, and I know that some hosts have disabled this by unregistering the dll file, which would also disable the Dictionary object. Could you check if the Scripting.FileSystemObject works?
Both objects are provided by Windows\System32\scrrun.dll (or Windows\SysWOW64\scrrun.dll if you're executing 32bit on 64bit host). Check the permissions on this file, and verify what privileges your asp script executes as.
Take a look at:
Tips for Classic ASP developers on IIS7
More Tips and Troubleshooting Help for Classic ASP Developers
Both the links are from Bill Staples' blog, he's one of the head honchos on the IIS side of things and the tips in the first link sorted me out when I was trying to get Classic ASP up and running.
I've found that calls to system objects such as
set rs = server.createobject("adodb.recordset")
and
set fs = server.createobject("scripting.filesystemobject");
sometimes fail after running fine for weeks on a production server. It's not a great solution, but manually recycling the app pool fixes it. Also, setting the app pool to recycle every few hours is a way to keep it fresh. Just make sure that you don't accidentally log everyone off (if using session for credentials).
It could be that the developer forgot to 'close' and 'set to nothing' the objects. Any objects you create using 'set' need to be allowed to dispose by setting them to nothing after use.
set rs = server.createobject("adodb.recordset")
rs.open sql, db, 1, 3 ' adOpenKeyset, adLockOptimistic
' some process here
rs.close
set rs = nothing
Related
I have a simple bat file that runs an access macro when executed, i need to know how to execute this bat file from a asp page, i have given all the permissions to the iusr_machinename for that particular folder containing the script file and the asp file.
Thank you
Note: I don't want to run anything on the client system, i just want to run a bat file on the same system the asp application is running
Assuming you understand the security implications of doing this, the code is as simple as:
set wshell = CreateObject("WScript.Shell")
wshell.run "c:\path\to\file.bat"
set wshell = nothing
I just ran this on a virtual instance without giving any special permissions to IUSR_* and it ran an xcopy without error or interference.
Another issue you will face is when your BAT file throws a prompt or wants to open some kind of dialog. It's really difficult to handle output, so make sure your BAT file runs without error before looking at further issues with the script.
Whether this code works in your environment is a matter of your security settings.
I finally make this to run changing IIS Application Pool defaults ( identity property ) from "ApplicationPoolIdentity" to "LocalSystem"
I have spent 12 hours on this, tried everything that I have read about, but I cannot get a new server farm we have,the website to write to a shared folder.
I have set the application pools, even temporarily (just to try it out) to admin accounts and even set the folder to be available for "everyone".
We have a network specialist who cannot figure it out either, in his favour he does not understand IIS very well and keeps away from it, but at the end of the day, its just a User account and permissions as far as I can see and I have set up the exact same website on a previous W2012 server and IIS 8.5, 7.5 and 6 without major issues (abeit registering 32bit DLLs in a 64bit environment) but all that has gone well and no issue (except for reading and writing to a shared folder).
SO breaking it down to its simplest form, I used a simple FSO script to write a text file in the shared folder, this clearly came back with "Permission denied line X".
Running the script through cscript as a VBS file, it works, running it through IIS. No chance.
Im not going to give up, but running as the top admin login (I had the network guy use HIS identity in the application pool) its not happening.
32bit has been enabled, yes, folder permissions set, yes.
Im at my wits end with the thing. Anything to suggest, I would be happy to listen and try.
Thanks all.
Update: I can write to the same MACHINE as IIS, any folder as long as I set the appropriate permissions. The difference between from this shared folder (I am working on a server farm, I forgot to mention that) is - when you do the security, locations "IIS AppPool\poolidentity" to add the user, it works on the same server, when I try to add that user on the shared folder on the networked server, that user does not appear - does this give any clues?
Ok - for me, after all the right things that I had done, was something I had not tried.
Select the site in IIS, so you sell all the icons for ASP, Authentication, Autohorization Rules, CGI etc.. - select the Authentication and Open Feature
You will see Anonymous Authentication (Enabled), ASP.NET Impersonation (Disabled), Basic Authentication (Disabled) and so on.
Select the Anonymous Authentication, right click Edit - by default it was set to "Specific User" IUSR - now for me, that did not work - so clicked on Application Pool Identity and boom, now its working.
Hope that helps someone else.
I've developing an asp.net core application to tun on a web far, and I'm using "AddDataProtection" to protect for key encryption at rest like, the documentation recommends, but when I deploy my application and run directly from IIS with AppPool identity, the key is never created and I get errors on the DpapiNG windows logs.
My code is the following:
services.AddDataProtection(opt => opt.ApplicationDiscriminator = ApplicationConfig.dataProtectionApplicationDiscriminator)
.PersistKeysToFileSystem(new DirectoryInfo(encKeyPath))
.ProtectKeysWithDpapiNG(string.Format("CERTIFICATE=HashId:{0}", ApplicationConfig.dataProtectionCertThumbprint),
flags: DpapiNGProtectionDescriptorFlags.None);
Debugging from visual studio, everything runs fine, but I'm running VS under administrator rights, so permission is not an issue here.
I've tried adding permissions to the AppPool App user to the private key it self directly from MMC, but it did not worked, and even gave permission on the full path to the location were the keys should be created like stated here https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview (check first comment) but also it did not worked.
I was only able to make it work by setting the AppPool to run with the identity of an Administrator, but clearly this is a no go, I just wanted to make sure this was a permission issue somewhere.
Is anybody facing the same issue that is able to help?
Regards,
André
Most likely your issue is you are trying to store your keys somewhere in a folder path that you are cobbling together (or even by using the default path that AddDataProtection provides) that uses an environment path such as %LOCALAPPDATA%. Example: "%LOCALAPPDATA%\ASP.NET\DataProtection-Keys".
Usually, by default IIS DOES NOT set up your app pool accounts with environment path variables such as %LOCALAPPDATA%. The value ends up being blank and your app then tries to write keys to the wrong folder (such as \ASP.NET\DataProtection-Keys instead of %LOCALAPPDATA%\ASP.NET\DataProtection-Keys).
Fix: Within %WINDIR%\System32\inetsrv\config\applicationHost.config set setProfileEnvironment=true. I think you have to restart IIS as well.
I've installed II7 + ASP Classic on my Vista business pc as I want to develop my own pctools (automate some boring manual tasks).
Unfortunately, every time I try to WRITE into a .txt file I get this error:
Path out = C:\Users\Carlos\Storage\bpmbck.txt
Microsoft VBScript runtime error '800a0046'
Permission denied
/pctools/cleanfb.asp, line 53
Line 53 contains set fileout = fs.OpenTextFile(pathout, ForWriting)
Given that I'm running as an ADMIN and that the target folder is owned by me, I don't understand why this is happening.
I've googled the net to find a similar basic problem (write to a text file) but I only find more complex ones (databases, mail, etc..).
An can anyone help me, please?
The identity/account for the application pool under which the site is running needs to have write permissions to that folder.
This is different from the user you are logged in as.
Give "users" WRITE access to the folder.
IIS 6 and older ships with a utility script called ADSUTIL.VBS:
Adsutil.vbs is an IIS administration
utility that uses Microsoft Visual
Basic Scripting Edition (VBScript)
with Active Directory Service
Interfaces (ADSI) to manipulate the
IIS configuration. This script should
be run using CScript, which is
installed with Windows Script Host.
In other words, this tool lets you change IIS metabase settings programmatically, from the command line.
I would like to call this tool from an InstallShield project in order to make some configuration changes to IIS. I am curious if it either legal to re-distribute the script (there is no legal wording inside the source for it) or to simply launch the command via:
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs
and hope that the script exists on disk in that location.
So my question is - will it always exist in that path above, even if some other websites (inetpub roots) on the machine are located on a non-system drive? It seems all MSDN and other Microsoft KB articles that refer to the ADSUTIL tool do so by using the %SYSTEMDRIVE% path above.
I see that at least one other attempt to deal with this by distributing both cscript.exe and adsutil.vbs with their InstallShield projects.
Perhaps there is a registry key or other method to obtain the location of the Inetpub\AdminScripts path?
Maybe I should just write a C# application that changes the value or my own VBScript and distribute with my own little app instead?
I ran into a similar issue recently and decided to just rework a small bit of vbscript to use in a custom action in an msi installer. It can take a bit to figure out the core of how adsutil.vbs does things, but it is deently well writen. For example, i needed to switch an application pool to Classic instead of Integrated mode and explicitly set it to run in 32-bit mode when on 64-bit windows, in distilled form this resulted in this:
Option Explicit
Dim IIsObject
Set IIsObject = GetObject("IIS://LocalHost/W3SVC/AppPools/TestPool")
IIsObject.Put "ManagedPipelineMode", 1
IIsObject.Setinfo
IIsObject.Put "Enable32BitAppOnWin64", CBool("True")
IIsObject.Setinfo
I worked in JShumaker's answer to solve the problem. The best route seems to be the following InstallScript function that I call to run a batch script:
prototype SetIISValues();
function SetIISValues()
string szProgram, szCmd;
begin
szProgram = TARGETDIR + "SetIISValues.bat";
szCmd = "";
LaunchAppAndWait (szProgram, szCmd, LAAW_OPTION_WAIT);
end;
The batch script calls this:
#echo off
cscript.exe SetIISValues.vbs
And the VBScript looks like this:
Option Explicit
Dim IIsObject
Set IIsObject = GetObject("IIS://localhost/w3svc/1")
IIsObject.Put "Name", "Value"
IIsObject.Setinfo
Doing it this way relieves the need to use ADSUTIL.VBS as part of the installation - the (relative) path to it is irrelevant if you don't need to use it.