Errors deploying ASP.NET project to remote host - asp.net

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

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

How to host asp.net webapi project with the current build on IIS

I want to host my ASP.Net Web api project on IIS for local development. I have an angular UI that wants to access this API. So for this reason I don't want to run my ASP.Net project all the time, if it were running on IIS would be better. I read many articles but none of them seemed to resolve my problem.
I know how to publish my project and then host the published version of the current build but what I don't want to do is having to do a publish every time I build just to test my code.
If I am not mistaken there is an option for deploying a new version of my project with every build. Again I don't want it to be production ready, I only need it for local development to test my API.
When I was using the publish > host currently published version on IIS the application was running.
When I was configuring IIS to point to the application folder where the solution is found as well (that is what I saw in an article about configuring IIS) I got: "HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
The solution is:
Go to IIS Manager in windows
On the left hand side of the panel, right-click -> add new website
Add a Site name that you like
Set up a Physical path, that should point to your project folder (so not where your solution is but where your ASP.Net project is)
Add a unique port that number that you make sure you are not currently using
Add a host name, and register it in the C:\Windows\System32\drivers\etc\hosts file with your local ip address

how do I share an asp.net application?

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.

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.

My ASP.NET application is not working on the server, but it works in my development environment.

My ASP.NET application is not working on the server, but it works in my development environment.
How do I go about debugging this?
First, when posting such a question to stackoverflow, post as many details as possible. These people on this site are brilliant and can fix your problem in a snap if you provide them enough information.
Confirm that you have deployed ALL dll, aspx, ascx, .vb, .cs, exe, image, and config files.
Confirm that you have deployed ALL folders
Confirm that your web.config has a valid connection string
Confirm that your entire folder tree has read/write permissions for network service account. (this can be backed down later)
Confirm that your entire folder tree has read permissions on the IUsr account
Confirm that your application pool (IIS Manager) has the same .NET Framework as your application was compiled in. It's probably .NET Framework 4.0, but might be 3.5 or 2.0
Confirm that the web server has port 80 and 443 open in its firewall
Confirm that asp.net is installed on the web server
Navigation to C:\Windows\Microsoft.NET\Framework\v4.0.30319 in the command line and run aspnet_regiis.exe -i if you need to reinstall asp.net 4.0. Sometimes this fixes problems.
Confirm that the web server serves up an html file. Add a file called test.htm to the root folder, and only include "Hello, I am test.htm" as its contents. Attempt to visit this in a browser. If it does not load, check permissions again.
Confirm that you have a dll on the server for every custom reference that you have added to your project, and confirm that the dlls are at an accessible path to the deployed web application (like, sitting in the bin folder)
I have the same problem as the person that post the question. I my development machine it runs smoothly. Deploying it in my own development machine opens the website bu gives me different w3wp.exe codes when opening a specific page inside my website.
I t seems it is a memory problem. I have tried different approaches but nothing seems to work.
The page that I am trying to open in has different linq queries.
I answer as much as I could from your questions.
Confirm that you have deployed ALL dll, aspx, ascx, .vb, .cs, exe, image, and config files.
Yes
Confirm that you have deployed ALL folders
Yes
Confirm that your web.config has a valid connection string
Yes
Confirm that your entire folder tree has read/write permissions for network service account. (this can be backed down later)
Confirm that your entire folder tree has read permissions on the IUsr account
Confirm that your application pool (IIS Manager) has the same .NET Framework as your application was compiled in. It's probably .NET Framework 4.0, but might be 3.5 or 2.0
Yes 4.0
Confirm that the web server has port 80 and 443 open in its firewall
Confirm that asp.net is installed on the web server
• Navigation to C:\Windows\Microsoft.NET\Framework\v4.0.30319 in the command line and run aspnet_regiis.exe -i if you need to reinstall asp.net 4.0. Sometimes this fixes problems.
Confirm that the web server serves up an html file. Add a file called test.htm to the root folder, and only include "Hello, I am test.htm" as its contents. Attempt to visit this in a browser. If it does not load, check permissions again.
Confirm that you have a dll on the server for every custom reference that you have added to your project, and confirm that the dlls are at an accessible path to the deployed web application (like, sitting in the bin folder)

Resources