Execute IIS .NET webforms website without precompiling the source code - asp.net

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

Related

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.

How to publish asp website using IIS7

I am trying to host my web application in IIS7 (for testing purposes). I have checked tutorials how to do it, they are very similar, but i always get some errors. I guess i'm missing something, hope you could help me.
Things that i have now:
1. Installed IIS7 with asp net (the IIS welcome image is showing, so i guess its installed correctly)
2. Simple web application (only with Default.aspx and some other automatically generated files)
I'm using tutorials like this one:
http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS-7-0
For those who may not want to click the link, here are the steps of this tutorial (just with mages and some additional info):
Step 1: From Visual Studio, publish your Web application.
Step 2: Copy the published application folder to "C:\intepub\wwwroot" [default] folder.
Step 3: From RUN - > inetmgr -> OK
"TestWeb" is a recently pasted webapplication on your wwwroot folder.
Step 4: We need to convert it to an application, just right click and then Click on "ConvertToApplication" as shown in the following picture:
+ How to create and assign application pools
Now about the errors i get when i'm trying to connect to the running Sample website:
1. If I'm using Framework 4.0 integrated application pool:
HTTP Error 500.21 - Internal Server Error
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
2. If I'm using Framework 4.0 Classic application pool:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
My guess is that something could be configured wrong in IIS7 or i might be publishing my web application not the way it has to be published, because they differ in tutorials that i am using. For now i am publishing, using File System option. Is it the right one for IIS7?
Hope anyone could explain me my mistakes.
Thanks, Walt
The answer for the questioner was to run the aspnet_regiis.exe -i from the framework directory
Below suggestions and comments leading to this answer :
I never had problems when publishing websites and webservices on IIS7 (for the moment) but I did a little research and according to the following link : http://forums.asp.net/post/3225843.aspx
It is suggested that after switching the AppPool to Classic .NET AppPool, it may be required for you to uncomment a section in the web.config which is necessary for IIS7
Did you try that ?
For number HTTP:500.21 check this asp.net forum
"Looks like you have not installed the asp.net feature from within IIS in "Add/Remove windows component" so that all the regstration needed to run asp.net is not present in your configuration." from the page.
For number 404.17 please check the asp.net module if properly installed or not. If not then you might have to install manually. Check this thread.

ASP.Net Web Application Deployment -

I'm trying to deploy/publish my ASP.NET WebForms application in VS 2010 but i'm having trouble doing so.
On the build settings "Items to deploy" section I choose:
"Only files needed to run this application" since I don't want others to access the .cs/designer.cs files and other code data.
Everything works flawlessly it seems, but when trying to load up the default page with my browser I get the following error:
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: The file '/MyWebApp/Default.aspx.cs' does not exist.
When I look in the deployed folder I obviously can't see the .cs file mentioned above, but from my understanding, I shouldn't see it anyways, since all code behind files are compiled into MyWebApp.dll which is located in deployed folder's bin folder.
Last thing worth mentioning is that I've added:
<validation validateIntegratedModeConfiguration="false" />
in my web.config to fix a different error I got earlier.
Not sure that this has to do with the previous error, but I thought it's worth mentioning.
What am I missing?
It sounds like it is still a web site and not a web application. Please see the following documentation for information on differences between a web site and web application:
Web Application Projects versus Web Site Projects
and this documentation for how to convert your web site to a web application:
Walkthrough: Converting a Web Site Project to a Web Application Project in Visual Studio

Microsoft.ReportViewer.Common gives "Access Is Denied" error

Using .NET 4.0, I have a small ASP.NET app that utilized the ReportViewer object, I have created a web page that takes some user input and generates a report that is displayed using the ReportViewer control with ProcessingMode set to local.
Naturally, it works perfectly when run via VS 2010 in debugging mode and if I publish it to IIS running on my local machine. However, when I push it to production, I get the following error when actually trying to run the report
For the image impaired:
Failed to load expression host assembly. Details: Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
I have verified that the assembly (as well as the other reportviewer dependencies) is in the GAC. There don't seem to be any errors in the event log on the server.
Any ideas what the permission problem might be?
What authentication are you using in IIS? (e.g. windows, anonymous, ASP.NET impersonation)
As it happens, the production environment I was deploying to is a web farm and the virtual directories point to a location on a network drive. When I tried deploying to a non farm server, with a virtual directory located on the server itself, this worked. The permissions are identical in the two environments, so I can only assume that something about this control didn't like being located on a different box than IIS and ASP.NET.
I'm not sure if this is actually an "answer", so apologies in advance if I've handled this wrong from a stackover perspective.

Issues within an ASP.NET 2.0 Web Application to Look for When Running on Linux with Mono

My IT department and I are trying to get an ASP.NET web application to run on a Linux with Mono. We have been working on this for about a month to no avail. The Mono setup on the Linux server seems to be good. We are able to run the demo ASP.NET pages on the server and they work fine.
I developed my ASP.NET web application with Visual Studio 2008, and I recently downgraded the application to ASP.NET 2.0. Originally it was in ASP.NET 3.5, which might be the problem. After publishing the web app, I received the following files: Default.aspx, Web.config, bin (with a .dll and a .pdb file), and an empty App_Data file. So far, the error that keeps occuring is an appication error on the server.
For a simple test, I made a simple ASP.NET web app that had a label and a button. We tried that app and it did not work either. Does anyone know of things that I should look for within my ASP.NET web application that would inhibit the application to work?
Application error:
Description: 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.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. this tag should then have its "mode" attribute set to "Off".
!--web.COnfig Configuration File--
configuration
system.web
customErros mode+"Off"/
/system.web
/configuration
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.
!--Web.Config Configuration File--
configuration
system.web
customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/
/system.web
/configuration
Thank you,
DFM
Just for a resolution, I finally figured out what the problem was. The ASP.NET web app has an onload event that enables the web app to read an Access Db. For testing purposes, I did not update the ADO.NET Db path for the web app to read the Db so every time it was loaded through Mono, the generalized error in question would occur. After deleting the onload event, the web app functioned perfectly. Additionally, I had to downgrade the web app to ASP.NET 2.0, instead of 3.5, and delete the LINQ namespaces, which were not being used.
All I have to do is change the path(s) to point to the App_Data folder and place the Db in the folder, as well.

Resources