Parser Error in Web Application after deploying - c#

I get parse error after uploading my Web Application to my server. I had an ASP.NET Web Site, but I migrated my files into a Web Application Project. Now, after I completed moving the files to the new project, everything works all right locally, but not at the remote server.
now afther i upload it to the server i get this error:
EDIT--------
this problem just keeping coming back even afther i tried put namespaces on of the .cs files
and republish the site.
even afther i publish the site all the CodeBhind files desapper so i add them myself via copy-past.
here how the solution explorer look and 1 of my aspx. files mybee you will see somthing worng i did:
here is my config file code:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
</compilation>
</system.web>
</configuration>
EDIT-----------------------------------------
i can see the site now online, what i needed to do is give all the files the same namespace, and not use a out side folder (witch i used every time) i just drop all the files/folders in the webroot thank you all!.

You probably have to set up namespaces for your entire project. Look at this walkthrough from Scott Gu's blog. It's for Visual Studio 2005, but it's pretty much the same.

<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
</compilation>
</system.web>
</configuration>
As per your web.config your target framework is 4.0 . Have you checked same your web site running in application pool in IIS is working on the same framework version?
If the framework is different on IIS than it might be cause of it. You can check it by Select the site on IIS, click ASP.NET tab, select ASP.NET version dropdown box.

I suspect you did not deploy the code-behind: main.aspx.cs

Related

How to disable IIS 8.5 ASP.NET 4.7.2 recycling on /bin changes and enable on /Views changes?

I was read tons of articles where is specified that I can disable ASP.NET application recycling after file changes using fcnMode="Disabled". I need applicaiton state (for example errors statistics).
Nice, but how to disable FCN on /bin but enable on /Views to update views.
The most strange is that IIS 8.5 after fcnMode="Disabled" blocks recycling in /bin and /Views but not updates views adter update *.cshtml from /Views.
IIS Express do the same apart updates views after update *.cshtml that is what I need.
I prepare such configuration for IIS.
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.7.2"/>
<httpRuntime targetFramework="4.7.2" fcnMode="Disabled"/>
</system.web>
</configuration>

How to deploy ASP.net website on somee.com?

I am trying to deploy sample website on somee.com using free hosting.
First I published my website as a folder. I already tested on my local machine on IIS 7 in my local machine. That is working fine without any problem.
1. I created new free hosting domain on somee.com, then in file manager ->
2. Then I make a zip folder for my published website folder
3. Then I upload the zip folder and select upload and unzip archives
4. Now this is my root folder file structure
5. I hope it will run the default.aspx file. Then I try to visit my site it throws error like below
Error msg
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b2d18bbc\3889fee\App_Web_home.master.cdcab7d2.cugbgmun.dll' -- 'Access is denied. '
Source Error:
[No relevant source lines]
Note
I created one small default.htm file for testing. If I upload that file. That's working fine.
Web.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
If I add the default.aspx file as a start up page on web config like below,
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="Default.aspx" />
</files>
</defaultDocument>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
Error msg
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
Here are steps to publish your .net to the server:
Please open your project with Visual Studio tool
On the Solution Explorer windows (which is normally located on the top right hand corner of the VS tool), right click your project and select Publish
Please kindly publish it to a local folder, such as C:\Project
Please just upload whatever files/folders you see on C:\Project to the server via FTP and your site will work fine.
The steps will remain the same. If you face 500 internal server error, please ask somee to check full error message on the server.
In Web.confilg file turn on the customErrors
<system.web>
<customErrors mode="On">
</system.web>
now add connection string carefully .Only change provider connection value
<add name="DBModel" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;**provider connection string**='your database connection path'" providerName="System.Data.EntityClient" />

Getting web.config error when publishing my ASP.Net website

I'm trying to publish my first ASP.Net website, but I'm getting this error when I try to visit the homepage.
Unrecognized attribute 'targetFramework'. Note that attribute names
are case-sensitive.
Here's the section of the web.config file it is referencing:
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>
And here's the website itself if you want to see the full error page:
http://connellchamberofcommerce.com/
Is the ASP.Net version (4.5.2) supposed to match the .Net version my host uses or something? As I said, this is my first ASP.Net website and I'm pretty confused by this error.
The version information at the bottom of http://connellchamberofcommerce.com/ indicates that the .net version of app pool is 2.0.50727.5491, where as in your web.config file its 4.5.2. So change the app pool to use 4.0.
Your web.config looks fine to me. My guess would be that you have set the wrong .NET version in the AppPool under which your site is running.
Go to your IIS -> Select your desired AppPool -> Click Basic settings and change the .Net version accordingly.

Web.config file not found after projects moved

I have a bunch of web projects in Visual Studio that I moved from the C: drive to the D: drive.
I,
updated IIS to point to the new locations
done an IIS Reset
restarted the computer
cleared all the folders mentioned on this page
cleaned all my solutions
rebuilt all solutions and so forth.
And yet when I run any SpecFlow test I get a HTTP 500 error, with the root cause being that it can't find the web.config file of one of the solutions because it is looking for it on the C: drive rather than the D: drive.
What could I be missing?
i think Chrome is your web browser? This is the default error page Chrome displays when it receives a 500 HTTP response from the server with no content.
Run the site directly on the server – depending on the configuration of your site/server, you may be able to see the real error if you load the site from a browser located on the same server. You may need to turn off ‘show friendly http errors.’
Temporarily add the following within the appropriate tags in your web.config file:
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
</system.webServer>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
</system.web>
</configuration>
After you have added those, load the page again to see if you can get a more detailed error.

disallow to view folder's file when it doesn't have a Default.aspx in it

Let 'Project/' be the main folder of the project.
If for example I had the folder 'Project/a', but it doesn't contain a Default.aspx file, how can I hide the files in it?
When I have for example, a folder as the above, the ASP.NET generates a list with all the files in it.
C# ASP.NET Visual Web Developer 2008 Express
I think you're looking for this option in the web.config file for the folder:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
Through the IIS 7 Manager, this is under the "Directory Browsing" option.

Categories

Resources