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
Related
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 10.0 under Windows 10 Pro. ASP.NET 4.7
Please consider this a newbie question -- it's been a while since I've worked with IIS.
I'm researching some issues that only seem to occur running under IIS (versus running the website in Visual Studio 2017). So, I installed IIS 10.0 on my Windows development computer and published my website to IIS. The error described below is NOT the one I'm researching, but a roadblock in trying to get my website setup on my local IIS.
When I try to access the "home" page, I get a 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 load type 'WingtipToys.Global'.
Source Error:
Line 1: <%# Application Codebehind="Global.asax.cs"
Inherits="WingtipToys.Global" Language="C#" %>
Source File: /global.asax Line: 1
(I also tried running Microsoft's Wingtip Toys sample website and I'm getting the same error as with my website. Showing Wingtip Toys error above.)
There is a BIN folder in my application (as installed in IIS), there is a WingtipToys.dll in that folder, and (according to .NET Reflector) there is a WingtipToys.Global class in the DLL.
I had thought ASP.NET would look for the BIN folder and use any DLLs it finds there.
As both the Wingtip Toys and my websites show the same error under IIS and both run fine in VS 2017, I suspect this may be an IIS or ASP.NET configuration error on my part.
What do I need to do to allow IIS/ASP.NET to find the binaries in my BIN folder? One suggestion I found was to put the following in my website web.config:
<system.web>
<compilation targetFramework="4.5">
<assemblies>
<add assembly="*" />
</assemblies>
</compilation>
</system.web>
While that works, we apparently don't need it on our production website (the one I'm trying to troubleshoot). (Plus, our production web.config has about 40 assemblies which are ALL in the website BIN folder. That seems to me redundant.)
I must be missing something.
If you have any questions, please let me know. Thanks!
As I figured, there was something missing from my IIS configuration. My original web app and the other sample web apps I used to test this were compiled as "Any CPU". In IIS, each of the application pools I used for these apps had "Enable 32-bit Applications" (under Advanced Settings) set to False. Once I set each one to True, all of the web apps worked as expected.
I no longer needed the "add assembly=*" workaround -- it looked like ASP.NET was finding what it needed in the BIN folder again. There was also an additional error of ASP.NET not finding the build provider for ASPX files. This additional error also disappeared.
Hope this helps someone in the future. Thanks for the replies!
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.
I have created an upload program that I'd like to sell but not give the source code out. I have published this on my web server and had no problems.
I compiled it and went to the bin directory and copied the contents to another folder on my web server. Tried to access it and got this:
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 load type 'AspxUpload.Default'.
Source Error:
Line 1: <%# Page Language="C#" AutoEventWireup="true" Inherits="AspxUpload.Default" Codebehind="Default.aspx.cs" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Source File: /u/default.aspx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1016
I'm rather new to asp.net, but I know what an application pool is. Can a program written in asp.net not be copied directly to the server and be expected to run?
I was testing what I was going to place in a zip file as a test but this will not run 'out of the box'.
What am I doing wrong or what am I missing?
UPDATE
Just for clarification, I'd like to be able to copy the contents of my zip into a directory and have it work without having to create an application pool, if that is feasible. Like I was saying, I was hoping to make this an 'out of the box' solution.
Is this possible with Asp.net?
====== UPDATE #2 ======
I found out that, in IIS, if I right click on the folder where the app is and convert to an Application, it works fine.
Do all asp.net apps need to be converted to an application if not published?
I have also updated the error message from the server where the website resides.
From what you're saying you might be trying to add an application within your application pool. If you publish your entire application to a folder, then zip it, you should be able to publish the contents of that folder to any web hosting (folder) that is configured as an asp.net application.
So when talking of out of the box software, in most cases when someone takes out web hosting for asp.net it will come configured as an application on the root directory. If this is where the file is unzipped to then it should work fine but if they use a subfolder within the root, then this may need to be converted to a web application.
In my experience some hosting companies will only allow a certain amount of configured web apps, and in a lot of cases only one, so this is worth considering if they app needs to be added under another directory.
Please have a look at this post to get around your issue.
http://blogs.msdn.com/b/robgruen/archive/2005/09/12/464196.aspx
I don't know why you would need to move the folder but first check that your web.config is in the root and that it has the appropriate access rights.
Then check any other folders for other web.config files or do a search for it in the application.
It sounds like an issue with either a duplicate web.config or that is missing.
Depending on the version of Visual Studio you have, you can use the "Publish" command. Have the application published to a package, which is a .zip file which can be imported by IIS 7 and above (at least, if you have the Web Deploy feature installed).
Publishing can not only save the application, but also IIS configuration if you're using IIS locally for your web application, and you can even deploy a database.
In addition, you can use web.config transforms to vary the web.config based on the build configuration. So that, if your publishing settings are for your "Test" build configuration, the package will contain the result of building with the "Test" configuration, as well as the result of applying "Web.test.config" to "Web.config" to produce a Web.config modified for your Test environment.
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.