Web.config file not found after projects moved - c#

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.

Related

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.

IIS 7.0 REST Web Service 404 error

I have a REST C# web service that runs fine under IIS 6.0 and IIS 7.5 but for some reason I get a 404 when running under IIS 7.0.
The path to my dll is as follows: wwwroot\PHSendMessage\bin\PHSendMessage.dll
My web.config is the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpHandlers>
<add type="Service, PHSendMessage" verb="*" path="Request" />
</httpHandlers>
<httpRuntime requestValidationMode="2.0" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
The class that inherits from IHttpHandler is named Service and this class contains the ProcessRequest function.
I am attempting to run the following url: http://localhost/PHSendMessage/Request?xml=hello
The above URL should call the get method and return the value from the "xml" parm to the screen, but I get a 404 error instead.
Everything I have read seems to point to the handler is not found, or not routing to my DLL correctly. I am not sure if the Web.config needs to have additional entries that are not required in IIS 7.5.
I have tried to follow numerous guides to adding the handler mapping but always the unhelpful 404 error. When following said guides I enter the Path and type similar to how I entered it in the web.config above and I may not be entering those correctly as I do not fully understand how these httpHandlers route to my dll.
Edit: I followed the following example: http://www.codeproject.com/Articles/112470/Developing-a-REST-Web-Service-using-C-A-walkthroug
I also followed their link to 404 errors. The source code from the above link is also results in the same 404 error.
Has anyone had similar issues?

Internal server error 500 on IIS 8

I'm having really a weird problem with my website. It works fine locally, but online it shows iis 8 500 - internal server error.
In the both online and local versions of the site I use the same remote database. The website works online, but it drops when I try to upload a file to the "upload" directory, which is part of the website.
I don't know what the problem is because I can't get any detailed errors. I've added these code pieces in web.config, but still can'tget detailed error descriptions.
<httpErrors errorMode="Detailed" />
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5"/>
<httpErrors errorMode="Detailed" />
I've also set the max file size:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4096" />
</requestFiltering>
</security>
and the size of the file I'm trying to upload is only few KBs. I suspect that the user doesn't have write permissions, and I asked the hosting admins to give write permissions (I'm waiting for that right now).
What do you think its the problem? Also, why am I not getting detailed errors?
Write permissions were the reason why I was getting the error.
I gave the folder read/write permissions before, but it looks like they were overridden when the newer project version was published.
(On publish we delete all files on the destination).

Parser Error in Web Application after deploying

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

Categories

Resources