System.AggregateException Error When Publishing Website in ASP.NET - c#

I decided to publish the ASP.NET MVC project to test it locally using IIS Manager. Therefore, after opening the necessary windows features, I created a new folder in the C:\inetpub\ directory on IIS Manager:
In the Visual Studio IDE I right clicked on the solution and clicked "Publish..." and specified that the target was "Folder":
When I clicked the Next button, I specified in the next window that the "Target" location was the C.\inetpub\TechnologyArticle directory. Then when I clicked the "Publish..." in the Visual Studio IDE, I encountered an error that I did not receive in Debug mode:
System.AggregateException: One or more errors occurred.
---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed.
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed.
---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed.
How can I solve this problem? Is the reason why I got this error in Release mode, which I did not receive in Debug mode, due to programming?

This error is not due to programming. The reason for this error is trying to publish the website in the C:\inetpub\ directory, which is made visible and/or created by a service that you have activated by "Turn Windows features on or off" to publish the ASP.NET website locally. The user has no right to modify the C:\inetpub\ directory. Therefore, the current user's right to modify the C:\inetpub\ directory must be declared manually in the Windows 10 operating system.
When the ASP.NET website is published, the project outputs (such as *.dll files, style files, scripts, Views) compiled in Release mode will be extracted to the target directory, so the user must have the right to write to the C:\inetpub directory.
To resolve this issue, follow the steps below:
Open the properties of the C:\inetpub folder (With the folder selected, use the ALT + ENTER shortcut).
Switch to the Security tab and click the Edit button.
Define "Full Control" right for current user and confirm settings by clicking OK button.
You repeat the publish procedure to publish your website.

Related

why am I getting: HTTP Error 500.30 error when publishing the Blazor server-side site?

I've made my web app on Blazor server-side and I'm trying to publish it on a windows server.
I tried different methods to publish but all came to the same conclusion.
HTTP Error 500.30 - ANCM In-Process Start Failure
Here comes a link to the image:
https://drive.google.com/file/d/1ndgb9Bh5BJH-tp_vR5vpfhWcr8BFgyh2/view?usp=sharing
As you can see there is no index file! why that's missing?
I used this instruction:
https://www.c-sharpcorner.com/article/deploying-a-blazor-application-on-iis/
Why am I having this problem?
You can see the result on mangoscarf.com
"ANCM In-Process Start Failure" is a generic error.
To get more information about the error go to:
Azure Portal > your App Service > under development tools > open Console.
You can run the application through this console and you should see the actual error.
(Type the executable filename of your project, i.e. "omgwtf.exe" and press enter.)
Also check here: https://learn.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-5.0&viewFallbackFrom=aspnetcore-5
I used this method:
Select the folder from the left menu and provide a folder path. You can provide any folder path where you want to publish your app.
Click on publish. Visual Studio will start publishing your application. If there are no build errors, then your application will be published successfully in the folder you have mentioned.
After the publishing is successful, you should move on to configure IIS.
more info on:
https://www.c-sharpcorner.com/article/deploying-a-blazor-application-on-iis/

System.Diagnostics.Process.Start causes error "No application is associated with the specified file for this operation" when deployed

I am new to c# and have created a web form using ASP.NET 4.7.2 and Visual Studio 2019. One of my buttons links to a url using:
System.Diagnostics.Process.Start("www.google.com", "_blank");
However, when I debug my app locally, it works fine. Once I deploy the app and click on the same button, this error shows up:
Exception Details: System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
This points directly at the line where I make the call to System.Diagnostics.Process.Start.
What am I doing wrong?

Windows Service - UnauthorizedAccessException Error when Installing Service (C#)

So I am trying to create a service using C# in Visual Studio 2017 and I keep getting an error when I try to install it.
Right now, I don't even have anything in my service, I just want to be able to install the service. I created a new Project in Visual Studio 2017 using the Windows Service (.NET Framework) template under Visual C# > Windows Desktop. I then added the installer via Right Click > Add Installer. For serviceProcessInstaller1, I set the account to LocalSystem. And...that's it!
Now, I try to install it. I open up command prompt (run as administrator) and I do
InstallUtil ServiceTest.exe
Things start off smoothly, but then I get a message:
"An exception occured during the Install phase.
System.UnauthorizedAccessException: Attempted to perform an
unauthorized operation."
What could be generating this message?
I've googled and tried the following things:
Ensure I run command prompt as administrator.
Assign Full Control to
the project folder to my admin account.
Configure permissions to Full
Control for admin account in the security log of regedit.
Log into my
computer as an administrator (rather than regular user) and run it
that way.
Despite these things, I keep getting the same error. What else could I be doing wrong? Would really appreciate some advice!
Note: I am trying to install this service locally on my computer.
Edit: Per request, here are the logs. I named my project "FailedService", by the way, since I can't get it to work!
InstallUtil.InstallLog
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe assembly's progress.
The file is located at C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.InstallLog.
An exception occurred during the Install phase.
System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
The Rollback phase of the installation is beginning.
See the contents of the log file for the C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe assembly's progress.
The file is located at C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.InstallLog.
The Rollback phase completed successfully.
The transacted install has completed.
FailedService.InstallLog
Installing assembly 'C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe'.
Affected parameters are:
logtoconsole =
logfile = C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.InstallLog
assemblypath = C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe
Installing service Service1...
Creating EventLog source Service1 in log Application...
Rolling back assembly 'C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe'.
Affected parameters are:
logtoconsole =
logfile = C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.InstallLog
assemblypath = C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe
Restoring event log to previous state for source Service1.
I was FINALLY able to resolve this issue. I was able to get to the bottom of it by using SysInternal's Process Monitor. I opened up the program and had it take logs for InstallUtil.exe. From there, I began to search for any logs that said "Access Denied". As I sorted through them, I noticed something interesting: it was trying to create a registry key, but it kept failing!
So I went into the registry and created a key named "ServiceTest". After that, I ran the InstallUtil command again, and it worked!
If anyone else is having trouble, the solution is to create a key named after your process name in the following location:
HKLM\System\CurrentControlSet\Services\EventLog\Application\
Enter the full path to installUtil & your service binary in an elevated prompt, that could do.

error of updating an C# web service application by accessing a URL from MS installer command "msiexec" in C# VS 2010

This question is related to my previous question.
I need to publish a C# application (that has been set up in IIS 6.0 and built in VS2010) to a desktop with win7.
I have set up IIS on my desktop well. Now I can install the application on my laptop by accessing the URL
http://myDesktopName.domain.com/MyApp
pointing to a physical location in desktop
e:\myPath\myApp\myAppService.svc
When I publish a new version of the web service, the application should get updated when I open it.
But, it gave me an error:
**the filename,directory name, or volume label syntax is incorrect**
After searching online, I found this error is normally caused by some unacccepted chars in the link. Here is the code that the msi (MS installer) needs to access and get the new version of the application.
System.Diagnostics.Process.Start("msiexec", "/favmuso \"" + myurl + "\"");
here,
myurl is http://myDesktopName.domain.com/MyApp/MyAppSetup.msi
Here, http://myDesktopName/MyApp/ is the virtual directory set in IIS 6.0 on my desktop. I can access and download it from IE in my laptop without any problems.
But, when the application notified me that a new version is available for updating the old one, I clicked the pop-up ballon on the application icon and then I got the error:
Error 123. The filename, directory name, or volume label syntax is incorrect.
If I try to access it from the C# code, I got the same error.
Then, I did a test by running
msiexec **/favmuso** http://myDesktopName.domain.com/MyApp/MyAppSetup.msi /Lv mapp_msi.log
In the log file, i found :
MSI (s) (80:DC) [18:04:33:089]: SECREPAIR: Failed to open the
file:http://myDesktopName.domain.com/mypath/\myAppSdetup (10).msi for computing its hash. Error:123
Error 123. The filename, directory name, or volume label syntax is incorrect.
Why my applcation setup file name was changed to
\myAppSdetup (10).msi
The "/favmuso" options can be found at
https://technet.microsoft.com/en-gb/library/cc759262%28v=ws.10%29.aspx#BKMK_Install
Any help would be appreciated.
thanks
So I noticed that you've asked this question elsewhere, and everyone was focused on the /favmuso piece of it.
I've been recently exeriencing this issue when trying to repair MSIs with a URL source when the original application was installed by SCCM 2012.
The workaround I found was to add a registry value at HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer. The value below causes the MSI to skip the problematic portion of the repair and move on.
Name: SecureRepairPolicy
Type: REG_DWORD
Value: 1
To be a bit safer, you look into setting the registry value to 2 and using a whitelist as described in this Microsoft article: https://support.microsoft.com/en-us/kb/2918614. (Ctrl+F "Steps to opt-out the affected programs".)

Error deploying to AWS through visual studio

My co-worker is able to deploy our projects to AWS Elastic beanstalk fine. However I have issues on both my work machine and my home laptop. Both computers have the same error in AWS window pane.
I get a pop up as follows:
Deployment of the website failed due to errors during build of the deployment archive,
check visual studio output window 'Build' and/ or 'Amazon Web Service' panes for more details.
Then in the amazon window pane I get a different error everytime I try to run the deployment.
Example 1:
...package build 'CopyPipelineFiles': error in 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets' at (1413,5): Copying file Web.config to obj\AmazonDev\TransformWebConfig\original\Web.config failed. Could not find file 'Web.config'.
Example 2:
...package build 'TransformXml': error in 'C:\Users\Andrew\colony\colony-website\Colony.Web\Colony.Web.csproj' at (840,5): Could not open Transform file: Could not find file 'C:\Users\Andrew\colony\colony-website\Colony.Model\Web.AmazonDev.config'.
Seems to be a different error each time -- I'm not sure how to even begin to look for any issues.
Jim Flangagan's comment is the answer: ReSharper 8.2 is causing this problem. To resolve either disable resharper ( Tools>Options>ReSharper>General>Suspend Now) or upgrade Resharper.

Categories

Resources