Debugging visual basic dll library from asp.net hosted in IIS - asp.net

I have the following problem.
I have some project written in Visual Basic (not Visual Basic .NET but simple Visual Basic - sic!). I can compile it and generate a dll.
Then inside my web application I add reference to this dll library. When I run my web application hosted in default Visual Studio server, everything is fine and I can debug my Visual Basic project. However, when I host my web application in IIS then I can't. Code does not stop in my breakpoint.
My asp.net catch the exception when I try to execute some method from the mentioned library which is something like:
Unable to cast COM object of type 'xxx' to interface type 'yyy'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{4C2875B5-3265-306B-9C74-1BEC98986B1A}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
Can someone please help me because I've been struggling for 2 days without success.

Are you debugging using "Attach to Process"?
First determine the w3wp.exe process:
For IIS6
Start > Run > Cmd
Go To Windows > System32
Run cscript iisapp.vbs
You will get the list of Running
Worker ProcessID and the Application
Pool Name.
For IIS7
Start > Run > Cmd
Go To Windows > System32 > Inetsrv
Run appcmd list wp
Note the Process ID (PID).
Next in Visual Studio:
Debug > Attach to Process...
Find the w3wp.exe with the right PID and attach
Your breakpoints should work.

Related

Failed to create CoreCLR, HRESULT: 0x80004005

I had clone a microservices in my local device and when ever I started that project I got that error
IIS Express is running.
Failed to create CoreCLR, HRESULT: 0x80004005
HTTP Error 500.30 - ASP.NET Core app failed to start
Common solutions to this issue:
The app failed to start
The app started but then stopped
The app started but threw an exception during startup
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
And this error come up in the view try each and everything like check environments variable check and updating Asp.net SDK's
And this error come up in the view try each and everything like check environments variable check and updating Asp.net SDK's
#alvarez response was the solution for me (running asp.net 7 in k8s).
Set the environment variable COMPlus_EnableDiagnostics to 0 in either your Dockerfile or k8s config yaml, and it'll start & run correctly with a readonly filesystem!

Visual Studio 2012 throwing error while building website

I am getting the errors below while building an ASP.NET website in Visual Studio 2012 over and over again. These errors are very random and sometimes I'm able to run the site after many attempts.
'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files\fccrcissues\94bcbaf1\224612b9\CSC7282803B8D0F44FBA57E415444603873.TMP'
is not a valid Win32 resource file
The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
The only solution I have is to build it over and over again until it succeeds.
Had a same problem! Try this. Have given link to solution too.
1st Solution) Under you IIS > Virtual Directory Properties > Execution Permissions might be marked as “Scripts and Executables” the dll is not being loaded so you are getting “System.Runtime.InteropServices.COMException”
Try changing the Execution Permissions to “Scripts Only” and applying it - It should work now!
I am not sure about the exact different between the two so all I know is:
Scripts only -> Run only scripts,such as ASP applications and
Scripts and Executables -> Run both scripts, such as ASP applications, and executables
2nd Solution) On your server where you're website sits, open the command prompt and run the following command:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i - It should work now!
http://www.strivingprogrammers.com/How-to-fix-The-handle-is-invalid-Exception-from-HRESULT-0x80070006-E-HANDLE

Microsoft error while synchronizing call from IIS?

I get the below error
***Retrieving the COM class factory for component with CLSID {046C184F-2188-4C99-A95A-9C0DCDC19050} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).***
while using the Microsoft Sync Services on execute of the below statement .
I get the error only when I run from the IIS that is http;//localhost/S71/default.aspx etc. But if I run by pressing F5 from my visual studio it works fine .
All other code like the "Provisioning process" everything works just fine only while I run from the IIS only and on the .Synchronize() method I get the error.
// Execute the synchronization process
SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();
which Sync Fx did you install? x86 or x64? if it is x86, check that your app pool is configured for 32-bit apps as well by setting the "Enable 32-bit applications"

MSBuild Extension Pack IIS7 task on remote server error

I have set up a Continuous Integration build with TeamCity and MSBuild. I am using the MSBuild Extension Pack, primarily for its IIS7AppPool Task. My goal is to stop an IIS app pool before the build script does a deployment step and start the app pool afterwards. The IIS app pool is on a different server from the build agent.
I have used the following MS Build code to stop IIS:
<MSBuild.ExtensionPack.Web.Iis7AppPool TaskAction="Stop" MachineName="$(DeploymentServerName)" Name="$(WebAppPoolName)" Username="$(DeploymentServerUsername)" UserPassword="$(DeploymentServerUserPassword)" />
I have set up a local admin user account on the web server, and used its username and password above as $(DeploymentServerUsername) and $(DeploymentServerPassword).
The error I am receiving is:
[MSBuild.ExtensionPack.Web.Iis7AppPool]
E:\TeamCity\BuildAgent\work\1a1dc058c29f0f12\BuildAndDeployment\Build_DevCI.proj(153,
5): UnauthorizedAccessException: Retrieving the COM class factory for
remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344}
from machine DEPLOYMENTSERVERMACHINENAME failed due to the following
error: 80070005 DEPLOYMENTSERVERMACHINENAME.
I have asked our network guys to take down any firewalls between the two machines, but I still get the same error.
Can anyone see anything wrong with my syntax or offer any advice on how to get this to work?
I can get the task to stop an IIS app pool on my local machine ok, so my syntax should be right.
I have looked at this post, but I don't think it's the same problem:
MSBuild remoting to server throws COMException error

Visual Studio Web Deployment project breaks ASPNET account permissions

I have built an ASP.NET web application with Visual Studio 2008 and target framework version 2.0. I have created a Web Setup project to deploy this at multiple target OSes.
For the setup project, I have written a custom action which gets executed on "OnCommitting" event. This custom action adds wildcard script mapping for routing all requests through ASP.NET engine.
FileMon suggests that an error occurs while creating a file in the following directory:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
The user account which was attempting this action was IWAM_<host name>.
The problem is after running this setup, if I try to access any url on the newly installed site, I received the error message:
Server Error in '/myapp' Application.
Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
I have already tried these options after 2 days of googling:
Run aspnet_regiis -i
Run aspnet_regiis -ga \ASPNET
Run aspnet_regiis -u and then aspnet_regiis -i
Option 3 has worked for me as of now, but, I want avoid using this, since, my web app will be deployed on a machine which might already be hosting some other app on IIS and I do not want to disturb these apps.
Can anyone suggest me a workaround for this?
B.T.W. my current system has .Net framework 3.5 and VS2008 installed on Win XP SP3 and IIS 5.1.
Thanks,
Vamyip
Your best bet is a custom bit of script in the installer package that checks permissions and then runs the command based on that information.
On a server OS this shouldn't be necessary since the default user for the application group will be in the IIS_WPG and have permissions to the temp directories. Windows XP has a bugged up version of IIS that is non-standard and doesn't follow all the rules. If your expected deployment environment is Windows Server 2003 or better then your installer should work as-is.

Resources