Visual Studio 2012 throwing error while building website - asp.net

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

Related

Execute IIS .NET webforms website without precompiling the source code

I want to publish to IIS the source code of my website (visual studio 2017 web forms website in vb.net or c#) without pre-compiling the project, so I can modify the source code directly on the server with IIS.
I know this is possible, I have done it in the past, and I have seen it done even now, but I cannot figure out what I need to do for this.
When I copy all the website source code to the server with the IIS, the website does not run... any ideas? or where to look for an answer? Is it a matter of setup? of the type of project?
When I call the website I get the following error:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The CodeDom provider type
"Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be
located.
Source Error:
An application error occurred on the server. The current custom error
settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could,
however, be viewed by browsers running on the local server machine.
Thanks!
#Gabe Thanks for the directions:
File - New Project, I see it under Visual Basic/Visual C# - Web - Previous Versions (ASP.NET Web Forms Site)
I tried it, and it works just fine! Basically if you create a project like you describe, you can just copy the source code in a server, without even installing visual studio there, and you can develop the site directly there.
This is ideal when you want to test things directly with external users, test things directly on the live or test servers, and of course you can make sure you have the source code of the project running, without having to keep both the source code and the compiled version.
There are a few drawbacks though:
1) you disrupt the website when you change things, and the application pool is restarted whenever there are changes, users in sessions are kicked out, etc...
2) there is a small delay while the site gets recompiled
3) there are cases where if while the code gets recompiled there are users online, there is asp.net corruption
Thanks for the replies!!
Regards
Manos

IIS: Parser Error Message: Could not create type

I am trying to build a simple web service in C# using VS2015 to be hosted on Windows Server 2012R2.
I have the code written and it works properly when hosted in the Visual Studio debugger. The debugger will launch IE and give me the UI to test the simple methods in my code. I can enter a temperature in Celsius and get back the temperature in Farentheit. So my understanding is that my code itself is working.
However, when I publish my project and attempt to load it in IE, I get:
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'TestAutomation.AutomationInterface'.
Source Error:
Line 1: <%# WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" Class="TestAutomation.AutomationInterface" %>
Source File: /TestToolsAutomation/AutomationInterface.asmx Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.81.0
I am publishing my project by going to Build -> Publish Web App. I am selecting "File System" as my publish method and am publishing to "C:\inetpub\wwwroot\MyAppName" in the Debug configuration with no check boxes in the File Publish Options. When I publish, I have the following files in the MyAppName folder:
-AutomationInterface.asmx
-Web.config
\App_Code
WebService.cs
The obvious issue I see here is that there is no .dll file created with my compiled code. I'm far from an IIS expert, but isn't this supposed to be created the first time a user requests the page?
I then re-published and checked "Precompile during publishing" in the file options. When I do this, a \bin folder is created with files "App_Code.compiled" and "App_Code.dll" files. However, I get the same error in the browser.
Because my code works in the VS debugger but not when hosted in IIS, I suspect the problem is on the IIS side of things, but I'm not 100% certain of that.
When I request the IIS page in IE, I get an event 1310 with source "ASP.NET 4.0.3.30319.0" in the application event log that says "Event code: 3006
Event message: A parser error has occurred" along with a stack trace that shows a bunch of System.Web.Compilation functions.
I have searched for this error on Stack Overflow and other sites, but none of the suggested solutions appear to solve my particular problem.
I would appreciate any help the community could offer.
UPDATE: I enabled failed request tracing on the server. It appears that the error happens here:
154. view trace
Warning
-MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName
ManagedPipelineHandler
Notification
MAP_REQUEST_HANDLER
HttpStatus
500
HttpReason
Internal Server Error
HttpSubStatus
0
ErrorCode
The operation completed successfully.
(0x0)
ConfigExceptionInfo
ManagedPipelineHandler
I lack the background to fully understand what IIS is trying to tell me. Any tips would be appreciated.
After struggling with this for hours and making all kinds of settings changes, and uninstalling and reinstalling IIS several times, I finally solved this.
I had to right-click on the folder in which I published my files in IIS Manager and select "Convert to Application." It's now working!
Here are a few possible ideas to explore:
Have you looked at the permissions for the account that the Application Pool in IIS is using to run this? There can be ASP.Net Temporary files that aren't being generated that could be an issue here.
Is ASP.Net registered with IIS? I've remembered more than a few times to have to run "aspnet_regiis -i" on servers to install the ASP.Net part so that it'll be present within IIS.
Is IIS configured to allow ASP.Net requests? In the IIS Manager on the machine level there is an "ISAPI and CGI Restrictions" to note.
Update: Perhaps you could look at the configuration for the Application Pool and see which .Net version it is using and whether it is integrated or classic mode. Those would be the next level of things to examine.

Visual Studio Build error after copy solution to new location

I inherited Visual Studio 2010 Web Site solution.The solution is pretty simple (but large), and only contains one project.
BUT when I copy the site to another location on my hard drive and try to build it, I get the following error:
Error 1
An error occurred loading a configuration file: Failed to start monitoring changes to 'C:\Development\SolutionFolder\app_code' because access is denied. C:\Development\SolutionFolder\app_code\web.config
Looks like some impersonation issue. Please check the local user permission on the app_code folder.

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

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.

Visual Studio 2003 - opening ASP.NET project - getting “The operation timed out” error message

On a Windows 2003 server I installed several versions of Visual Studio, also Visual Studio 2003. On the server I want to develop two different webapplications. One web application is working, but I go problems on the other one.
When I try to open the application (after a rebuild), I get the error: "The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/MyApp'. 'The operation timed out'." I have already seen that the problem disappears when I delete the dll file generated by building. Because the environment will be distributed to multple users, it is not an option to remove the dll everytime to start Visual Studio.
I already tried multiple times to reregister asp.net with aspnet_regiis -u, aspnet_regiis -i and aspnet_regiis -r.
When I execute aspnet_regiis -lv I get the following:
1.1.4322.0 Valid (Root) C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll
2.0.50727.0 Valid C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
Does anyone knows a solution to this problem?
This was still a problem for me after following the steps proposed above. Here's the solution that finally worked for us.
Turn on IIS logging on your local machine. Be sure to log the query string and the HTTP response code.
Attempt to open your solution and let it time out.
Perform an iisreset to flush the IIS logs.
Open the IIS logs. You will notice that when you opened your solution you generated quite a bit of activity.
VS2003, for whatever reason, attempts to navigate to some of your pages... in particular, it may navigate to your login page if you have forms authentication turned on.
Check the processing time and HTTP response code in the log entry for your login page. In our case it was returning a 302 HTTP redirect.
In our code, the login page starts up by checking for a cookie and redirecting to an external page if it isn't found. This redirect is to a location that is not accessible in the dev env. So VS would open the page, follow the redirect, and time out trying to get the page.
We fixed it by modifying the login page with the following code:
//If Request is coming from Visual Studio, just return an error
if (Request.UserAgent.StartsWith("Microsoft-Visual-Studio.NET"))
{
Response.StatusCode = 500;
Response.End();
}
Visual Studio can handle the 500. It can't handle a 302 to an unknown host.
Hope this helps.
Did you apply service pack 1 to visual studio 2003?
http://www.microsoft.com/downloads/details.aspx?familyid=69d2219f-ce82-46a5-8aec-072bd4bb955e&displaylang=en
This worked for me...
http://forums.asp.net/p/1192304/2066860.aspx
On my XP development machine I went to "C:\Documents and Settings\USERNAME\VSWebCache\USERNAME\" and deleted the folder matching my VS2003 solution name. (Actually I moved the folder to C:\Temp just in case). This worked, although one designer file would not load without a re-build and the start-up page needed to be re-marked. I don't understand why my solution depends on this VSWebCache (it re-appeared when I re-built my solution.) Can anyone explain this dependence? It's un-settling.

Resources