VC++ 6.0 App must run as Admin to access a DB in the Common Application Data area - visual-c++

I have an old C++/MFC app written with VS 6. I am trying to make it compliant with Windows Vista and 7 by moving the DB directory to the Common Application Data area. But when I try to open the Access DB using DAO it reads the primary table, finds no records, and reports that no data is found. However, if I select "Run as Admin", then I can access it without an issue.
Should I be storing the database in another location? If not, why does it fail to read the table correctly?
Also, I have tried using the manifest listed below, that I found online, but it does not seem to force the application to run as admin and so I still get the no data found message. But I don't know much about manifests yet, so it could be that I didn't configure it correctly.
Thanks for any help or advise you can give.
FieldAppl

Here is the manifest I used to ensure my custom-written installer ran as an administrator. In addition to this manifest, I also digitally signed the application with a Verisign certificate.
Scott
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="Setup"
type="win32"/>
<description>Software Installation</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly
>

Related

How do I deploy Blazor WebAssembly Core Hosted Self-Contained App to IIS [duplicate]

This question already has an answer here:
asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19 (0x8007000d)
(1 answer)
Closed 2 years ago.
I have developed a Blazor WebAssembly App that will be used on a Server running Windows 2012 on our Intranet. This is targeting .Net 5.0 Core Hosted and Self-Contained. I need to deploy to IIS 8.5 and have some questions.
When I add the website in IIS, do I point to the root deploy directory with the executable and web.config?
Is there anything else I need to do so that IIS will find the index file in the wwwroot sub-directory?
Is is appropriate to put the deploy directory for this app directly under inetpub?
The publish task created a rather large BlaorDebugProxy directory. This is for release so I don't understand why this was created. Is there a way to prevent this from happening?
I want to access the app using ServerName\AppName. If I create the site with 'AppName' for the host name, will that work or is there something else I need to do?
When I try to browse to the site from IIS, I get a 500.19 'The requested page cannot be accessed because the related configuration data for the page is invalid.' I have not made changes to the file as it was created by the publish process. It is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\AppName.Server.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 60862cf1-bea8-48f4-8ae9-270f2f537927-->
Any ideas why this is not working?
PLEASE NOTE that this is using the SELF-CONTAINED model.
Also, I have made sure that the directory has granted full permissions to the App Pool Identity for this App.
The answer below and the supposed duplicate all refer to installing the framework. However, I thought that the whole point of the self-contained model is that it does not rely on an installed framework.
I have searched extensively and see many references that touch on these issues but nothing that says specifically how to get IIS (especially an older version) to host the self-contained model. The Microsoft pages talk about advantages and disadvantages and how to create the files but no details about how to host them or the other questions I listed above.
Has anyone done this successfully who can provide some guidance?
Thanks !
Firstly, please ensure that the Asp.net Core IIS Hosting Bundle installer has been installed on the server.
https://dotnet.microsoft.com/download/dotnet/5.0
Besides, the identity under where your web application runs in IIS should have full access to the root folder of your website. Try to grant the IUSR account full control to that physical path.
Last, please refer to the below link to hosting Core-based web application in IIS.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1
Feel free to let me know if the problem still exists.

Disable Windows ComCtrls manifest in InstallShield

I am building a windows installer for my .NET application and it looks like InstallShield (2012 Spring - Premier Edition) is adding Windows Common-Controls manifest to my icons converting them to DLLs.
This is hitting my application's performance as OS encounters a page fault as it tries to parse the icon image on launch.
Here is the manifest that IS is appending.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.YourApplication"
type="win32"
/>
<description>InstallShield Icon Res</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="<>"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
First a short digression into why this is happening. The Icon table, where Icons need to be stored to support Windows Installer advertisement, requires that "Icon files that are associated with shortcuts must be in the EXE binary format and must be named such that their extension matches the extension of the target". Thus InstallShield builds the correct format file. And by "build" I really mean it stuffs the icon data in a resource on a template EXE file.
So what's the upshot? You can change the resulting manifest by editing the template. The template is stored in ...\Support\_IsIcoRes.exe, and if you open that in Visual Studio or another resource editor, you can examine or even edit the manifest in RT_MANIFEST (24) \ 1. This file isn't signed (yet) because the build process will have to modify it, and thus would invalidate any signature, so your edits should be safe. That said, keep a backup of the original in case things go awry.

iis 7 + http custom handler error: could not load file or assembly The system cannot find the file specified

Windows vista 32 bit - C# - .NET 4 - sqlite - IIS 7
I'm building a small project that contains is a custom HTTP handler where an user can request a XML file and the project will generate the file and send it to the user. It should be flexible enough to send something else too like e.g. json.
Everything was going well until I had to deploy the handler. I've created a library (dll) file which contains the logic for serving of the requested information. I've open IIS manager and I've created a virtual directory to the debug bin file (later on i made it an application. it did not make a difference).
I've followed countless examples and tutorials like these ones:
I started with this one: http://support.microsoft.com/kb/308001
http://msdn.microsoft.com/en-us/library/bb515343.aspx
msdn.microsoft.com/en-us/library/46c5ddfy.aspx
But with no luck. As you could have read I'm not using any asp.net website even though I do have a web.config that I've added to the bin folder and it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
<directoryBrowse enabled="false" />
<handlers accessPolicy="Read, Script, Execute">
<add name="LigoManagedHandler" path="*" verb="*" type="Ligo.Service, Ligo" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>
When I try to run handler in the browser get the following error:
Could not load file or assembly 'Ligo' or one of its dependencies. The system cannot find the file specified.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Ligo' or one of its dependencies. The system cannot find the file specified.
I have tried so many possible combination in IIS manager to get it working ('httphandlers', 'classic mode' and so on ...) but i'm truly stuck. The information I've found on the internet is not helping much.
What am I doing wrong or missing to make it work?
Something in this rant triggered an idea, an I stumbled on the answer.
The line in all those tutorials that say put type="ClassName, AssemblyName" into the Handlers section in Web.Config are plain WRONG.
All I did was change this to type="AssemblyName.ClassName" and everything started working, in both a Web Site Project and a Web Application Project that I had created.
I'm running IIS 7.5 in integrated mode so YMMV.
Craig
I figure it out. I had to make a asp.net website project and add my dll as reference to this project.
I read this thread that provided this information which is not clear on the internet.
http://forums.asp.net/t/1088861.aspx/1?What+causes+the+quot+Could+not+load+type+quot+problem+
It should state that it is not possible to make the httphandler without a aspnet website project. or am i mistaken? the example on the internet are incorrect! or provide too little information.
I know, this is an old thread. However, I've been looking for an answer for a few days without finding a clear one. So, in case anyone comes across similar scenario.
You can create custom Http Handler as a stand-alone Class Library project and use it in IIS.
On IIS Add new Application with ASP4 Integrated mode. Place your compiled DLL into bin folder (this is what i was missing all along). Seems obvious that it should be there; took some time to figure this out. :)
web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<handlers>
<add verb="*" path="*.ogg" name="test" type="Namespace.Classname"/>
</handlers>
</system.webServer>
</configuration>
Hope this helps.
Cheers.

Sharepoint webpart deployment - activate features error

I'm a noob to Sharepoint development, actually I hoped I'd always be a noob to it, and I'm having difficulty building my first web part for a Sharepoint 2010 website. I'm using Visual Studio 2010, and I started with a Visual Web Part. All i added was a simple asp:Label control, as I just want to make sure it's deploying correctly before I go any further. It builds, says it's deploys even, and then croaks on the 'activate feature' step. I get the following error.
Error 1 Error occurred in deployment step 'Activate Features': Feature with Id '12765e82-6e4a-4407-aa8c-77b537841f4b' is not installed in this farm, and cannot be added to this scope. 0 0 scCodePart
There isn't much out there to go by for help on this. I made sure the scope of the feature was set to 'Site', as was recommended. I even tried changing the xml of Feature1.Template.xml to:
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="12765e82-6e4a-4407-aa8c-77b537841f4b" Scope="Site" xmlns="http://schemas.microsoft.com/sharepoint/">
</Feature>
And the error persists. I read something about the web.config of the site might causing it, but it provided no explanation as to why. Any thoughts?
EDIT
There is my Elements.xml:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
<Module Name="scClosetCodesVWP" List="113" Url="_catalogs/wp">
<File Path="scClosetCodesVWP\scClosetCodesVWP.webpart" Url="scClosetCodesVWP.webpart" Type="GhostableInLibrary" >
<Property Name="Group" Value="Custom" />
</File>
</Module>
</Elements>
and my Feature1.Template.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
</Feature>
I haven't altered either one of them from what Visual Studio initially creates. I tried declaring the id & scope in Feature1.Template.xml, but i got the same error after.
kindly go through the following URL which has complete solution for your problem
http://blogs.msdn.com/b/sowmyancs/archive/2008/04/02/server-error-feature-guid-is-not-installed-in-this-farm-and-cannot-be-added-to-this-scope.aspx
It sounds like you have the incorrect scope set for your feature. Take a look here to see what features can be deployed at what scope.
Simplest way is just to weak that scope setting, redeploy and see if you get a better result :)
if you have farm admin privilages, you can goto the Central Admin -> System Settings -> Manage Farm Solutions
Select Project.wsp file and click on Deploy Solution
Depending the feature scope setting, go there to activate it.
For Example, if its site collection level, goto site collection settings and activate it.
Alternately you can also use powershell to do the same thing.

Windows Media Center Application and UAC

I'm currently trying to write a Windows Media Center Application (Vista) that can restart a service with UAC enabled. Everything works fine when UAC is disabled but as soon as UAC is enabled I get an Access is Denied error.
I believe this is because the Window Media Center applications are running under the Windows Media Center process and as such would need to be started as Administrator for this to work. Does anyone know how I might achieve this with UAC enabled?
Check this out. Sounds like you'll need to flag the process to ask UAC for permission to continue:
http://technet.microsoft.com/en-us/magazine/cc138019.aspx
You can mark your process as needing to be elevated by adding
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="CheckForceElevation" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
To the manifest.

Resources