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.
Related
hoping someone has some insight into this issue I get pretty commonly.
I have an ASPX Web Application that is pre-compiled. I have this application running within another IIS application working flawlessly. The parent application has an "updatable=false" property within the PreCompiledapp.config.
Now I need to add more pages to my application, which I create the same way in visual studio, and publish them with the rest of the application. When I open these files to check them in notepad, I can see the "This is a marker file generated by the precompilation tool, and should not be deleted!" as well as the .compiled file that generates with it.
On a local machine and application instance, this works... but when I copy the same applicaiton build to a client (same application, same pages, same everything) it gives me the " xxx.aspx has not been pre-compiled and cannot be requested " error.
What could be some causes of this? The pages are pre-compiled so I'm wondering if this can be thrown for something else. Any help is appreciated thanks!
I think the cause may be the parent application is set with updatable=false but the ASPX Web Application which you published is allow update. So it may lead to this problem. The same error message and the cause are described in detail here.
To solve this problem is convert your application to web application(has its own AppDomain and configuration) or publish the root application as updatable as well.
I have a asp.net project that is working very well on my machine (on localhost) ...
But when I put it on a real host (put it online) a faced a problem ....
I got this 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: Could not load type 'AWP_Project.Default'.
Source Error:
Line 1: <%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AWP_Project.Default" %>
Line 2:
Line 3:
there is a problem in the first line of this page (and every other page when I try it)
note : my project name is AWP_Project
can anybody helps my please ???
A common "pitfall" when it comes to moving your (compiled or not) project to your web host from your local machine is that the web host may not have the same configuration as your project/local/development machine.
make sure you have all the assemblies in your /bin folder
if you somehow created assemblies (dlls) for each file, then make sure all of them are copied to your web host
Your web host will (likely) have different security settings than your own machine while you are debugging. You're working on full trust locally/in Visual Studio, while most, if not all web hosts will likely be using medium trust. So a good rule of thumb while developing in Visual Studio is to set your web.config to medium trust to avoid pitfalls "at the last moment" - particularly if you don't have a dedicated machine at your web host.
just because you have .Net 4 on your machine, doesn't automatically mean your web host has it. You can bin deploy the assemblies you need - in VS 2010 right click your project and select "Add Deployable Dependencies" - this will add all the necessary dlls you need in your /bin folder. Yes, you will likely not need all of them, but unless/until you're fairly comfortable in choosing which one should or shouldn't be deployed, you'll have to trust Visual Studio....
I'm hesitant to add this, but still - ask your web host what verison of ASP.Net/.Net Framework they support. It sounds funny but trust me, I'm hosted on one of the largest and well known/trusted web hosts out there and to this day, I have to contact support (but their support is "fanatical" - clue to who it is) to have my web site/s set to ASP.Net 4 (they support it but an extra manual config is needed by their personnel).
hth
Try to create a virtual directory/website on your remote host and upload to root of that virtual directory via copy web site menu or publish website.
Often, your app doesn't work if you upload to a folder only. you should copy to the root of virtual directory or create a virtual dir that refer to your folder.
Please check this url link: Cannot use asp classes in app code/bin/web service
Hope this help
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
after uploading my project to server i am getting following error please let me know what is the following error
CS0433: The type 'Course' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\672b2bdf\9fb2ad98\assembly\dl3\afaf3b67\f1871969_3e5bcb01\App_Code.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\672b2bdf\9fb2ad98\assembly\dl3\29fd4e0e\f1751c7e_3e5bcb01\App_Web_spb4jssk.DLL'
and
Line 111: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 112: public class admin_course_aspx : global::Course, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {
Line 113:
Line 114: private static bool #__initialized
and
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\672b2bdf\9fb2ad98\App_Web_course.aspx.fdf7a39c.gdurkajz.0.cs
Line: 112
It looks like you may have a Web Site, and not a Web Application Project.
For a Web Site, you get a lot of arbitrarily named .DLLs, such as your "App_Web_spb4jssk.DLL" above. These names are different every time you compile.
What's probably happening is that when you add your new dlls to your production server, the old one (with a different name) is still there, and contains the same class names as your new ones.
What you have to do is delete everything in the bin directory of your production server before you upload your new ones.
Ideally, what you should do is convert your web site to a Web Application Project.
Update:
Here is an article that describes how to convert a website into a web application project. It's specific to VS2005, but the steps are basically the same for VS2008 and VS2010.
The difference between a website and a web application project is that in a web application there is a project file that keeps track of all the files and settings for your website, just like for any other Visual Studio project. A web application will also compile your entire site into just one dll.
If you have a web site that doesn't have a project file, it doesn't explicitly know how you want to compile your website, so it ends up creating a bunch of separate dll files with random names.
I would also recommend what Claudio says. However, you may want to double check that you don't have any source files in the App_Code directory that were erased in your local copy (as they were moved into a different DLL)
Its been a long time since I had to do anything but minor fixes with ASP.NET and I've never deployed a ASP.NET 2.0/3.5 application so probably I'm just missing something simple but I definitely need help.
Basically, we have a poorly written .NET 1.1 web application and we had some contractors come in and break some of our third-party dependencies and update it to a poorly written .NET 3.5 web application (the poorly written part will be addressed later).
So now I'm practicing deployment scenarios on a virtual machine set up like our deployment environment.
I installed the 3.5 framework
I compiled the new code and used visual studio's Build>Publish option as recommended by the contractors to output only the files the application requires.
I copied all the files to a new directory inside of Inetpub on the VM and configured the web.config
I created a new application pool
I created a new IIS website pointed to the new directory and using the new application pool. I configured it to use version 2.0 under the IIS ASP.NET tab
But navigating to the loginpage I get:
Parser Error Message: The file '/View/LoginPage.aspx.cs' does not exist.
Line 1: <%# Page Language="C#" MasterPageFile="~/MasterPage/LoginMasperPage.Master" AutoEventWireup="true"
Line 2: CodeFile="LoginPage.aspx.cs" Inherits="MyApp.View.LoginPage" Title="MyApp - Login Page" %>
What gives? In the .NET 1.1 version of the application all the c# code was compiled into the MyApp.dll and the application knew to look there. Double checking with reflector, all the code is in the binary here too, just the server isn't looking there for it.
What can be going on? I can wait for the contractors to get in tomorrow, or compile everything including the aspx files into the binary, but we have good reasons for keeping the aspx files uncompiled and I'd like to deploy today if possible.
Please note, that this is not ASP.NET MVC, the view namespace/directory is simply where all the webforms are kept
You have probably used the Web site model for your updated application. Consider using a Web application project instead.
Change the CodeFile= reference to CodeBehind= in the "<%# Page" directive.
In visual studio try this. Click on your web application project. Go to Build > PUblish > Choose the location > click publish. That will build everything and put all the .cs files into a single dll file. It will also leave your html/aspx files in their same locations. This allows you to do what you need to do with the aspx code, while keeping all your cs hidden away.