asp.net/vb.nrt select local web.config file only - asp.net

I am deploying an asp.net solution written in vb.net, the solution works fine on the localhost server and on my development server. On the live server the solution keeps ignoring the local web.config file and is using one belonging to another persons project which I have no control over.
This is the list of files that are in the folder I uploaded to the live server:
imageFolder
Default.htm
FormDelete.aspx
FormDelete.aspx.vb
thankyou.htm
web.config
I want my solution to only look at the web.config located in the same folder as it, and not inherit any values from another web.config file. Can this be done?
Thank you in advanced

This happened to me some days ago; as I was the owner of them both, I deleted the app I didn't need, and restarted IIS.
Maybe there are some similarities between your app and the other one, or there is some bad redirection, I don't know. In my case, the other app just linked to a test database, that's how I knew there was an issue.

Related

Can't Access App_Code and App_Data on IIS

I just published my ASP.NET Website on IIS and have already configured it to be working, everything is running smoothly.
Except.. I can't accept the App_Data file where all my database information is stored. That might not be the only folder that i can't access but maybe possibly App_Code too? Where i place all my Data Access Object classes (CRUD).
I searched high and low on blogs, articles and stackoverflow but i still can't find the solution to accessing the folders.
I also read that by default certain file extensions are being blocked by IIS
These are some hopefully useful information..
It appears that App_Data and App_Code folders are empty..
Codes in Web.config file from Published Directory
Have some issues copying the codes..**
File Segments in IIS
ConnectionStrings in IIS
Error i'm getting..
Any help is appreciated..
Ok this is what you can try to isolate the issue.
Enable Failed Request tracing for the website for which you are seeing this failure.
This will help you determine where the error might be coming from.
Looking at the call-stack you provided, it seems that there is a different issue. I would suggest you to debug the web app on the server to understand what the problem is. Refer the instructions here: https://msdn.microsoft.com/en-in/library/mt621540.aspx

ASP.NET - Publishing a web site to IIS

What is the difference between publishing a website to {localdrive}\inetpub\wwwroot and anywhere else on the web server e.g. C:\Website.
I have noticed that I am always left with a directory and a website in the IIS console if I publish to {localdrive}\inetpub\wwwroot.
After reading articles on MSDN, I am still unclear of the difference. I realise that there is probably a simpe answer to this, but I cannot find it.
The web path / is already mapped to c:\inetpub\wwwroot, so /abc is mapped to c:\inetpub\wwwroot\abc automatically.
When you publish to c:\website, you need to set up a virtual path manually.
Nothing too much as your website path in IIS can point to any directory. However, that being said always double check your directory permissions and security settings. In addition, I guess if a hacker did compromised your webserver... the default c:\inetpub\wwwroot is well known.
And just for good measure in case you are having issues - check out the Aspnet_regiis.exe tool on MSDN as it usually solves a lot of issues for folks.
{localdrive}\inetpub\wwwroot is usually used for the default web site that comes with IIS.
Additional Microsoft products use the same directory and take advantage of the virtual directories that exist in the default site.
If this is your personal web site, or a web site you created from scratch, you can publish anywhere you want.
Before you publish, you need to make sure IIS knows where the directory will be, and you need to assign the correct permissions for that folder.
The default website in IIS is mapped to C:\inetpub\wwwroot by default, so publishing to wwwroot makes it easy to add applications as virtual directories.
However, you can publish wherever you like, and either point a virtual directory or new website at your publication location. You simply need to make sure user the App Pool is running as (usually IUSR under IIS7, IUSR_MachineName under previous versions) has read/execute permissions on the folder you are publishing to.
Although they say Virtual Directory created by default for your website in wwwroot and you don't have to configure it again. Many times I found we still have to go there and click on Remove and then click on Create button again :)
Thus it is almost no problem if you create your website outside wwwroot, only difference outside you have to give full path of VD and inside you have to click Remove and then Create button
The problem I had was different from all of the above. I was trying to publish in "C:\inetpub\wwwroot" and the publish failed every time. Than i changed the publish folder to another and it worked. When I launched visual studio as administrator I could copy to C:\inetpub\wwwroot also without problems

datadirectory incorrect in nested application

I have used the |DataDirectory| value in a connection string in web.config. It works fine on my local machine.
However it fails when the site is uploaded. The uploaded version of my site is a sub-directory / sub-application of another site. The |datadirectory| value does not reference my App_Data folder, but a folder on the hosting computer.
Is there a way around this? I want to avoid having 2 different web.config files.
Did you check that SQL Express is supported at your host? If not ask their support team. It could also be that you need to attach your .mdf file, after uploading it to the server, to a full blown SQL Server. Again ask your hosting company. Also you should receive from them the correct connectionstring. Also find out more about Connection strings.
Grz, Kris.

ASP.NET impersonations?

I have a aspx file that suppose to write to a file in the server while loading. On the local machine it works fine, but when i deploy it to a live server it gives me an exception "Access to the path 'd:\DZHosts\LocalUser\asafz83\www.asafz83.somee.com\lala.htm' is denied."
WHen i asked my serverAdmin for the reason - he told me to remove any impersonation from my web.config file. Well, my web.config file doesn't contain any impersonation, so i'm really confused:
What can i do in order for this sealy-stupid application to work?
thanks!
Assuming the id being impersonated has appropriate access to the server & folder that you are writing to, you have to allow your web server to be trusted for delegation.
See this for Windows 2003 server:
http://technet.microsoft.com/en-us/library/cc738491(WS.10).aspx
I've had the same problem a couple weeks ago..it took us a few days to figure out that it's just a checkbox that needed to be set.
You don't have to go through impersonation.
Create a folder in your website, let's call it "Files". You can access its path via Server.MapPath to do whatever saves you want in that directory.
Server.MapPath("~/Files")
When you deploy on IIS, you have to apply Write permissions on the folder "Files" for the ASP.NET user.
Essentially your server admin is saying that you may not have the permissions needed to perform the operation / access th path in the error.
Is this a valid path that you think you should have access to, if it is then there is a chance your application is configured wrong.
Your admin guy is basically saying ...
In the web.config file check that you have not got something that reads like this :
if you do, remove it because you re trying to impersonate / get asp.net to run within the context of the guest account for internet users connecting to the server.
There is more on the topic here ...
http://msdn.microsoft.com/en-us/library/xh507fc5(VS.71).aspx
Something worth noting is that application configs "inherit settings from parent applications", this means if you have a web app running that works with this, and then in a child folder deploy a new web app that does not have the right to do this then it will break because of the parent applications settings.
This may or may not be relevant to your situation but i feel its worth noting.

ASP.NET 2.0 - How to use app_offline.htm

I've read about the app_offline.htm file which can be placed within the root of a .NET 2.0 application which will in essence shut down the application and disable any other pages from being requested.
I've placed the file in the root, and my site still loads. I went into default documents in IIS and set it to app_offline.htm and the site still loads (this might have been a caching issue though)
Anyway, has anyone run into issues using this? Am I doing something wrong?
I have used the extremely handy app_offline.htm trick to shut down/update sites in the past without any issues.
Be sure that you are actually placing the "app_offline.htm" file in the "root" of the website that you have configured within IIS.
Also ensure that the file is named exactly as it should be: app_offline.htm
Other than that, there should be no other changes to IIS that you should need to make since the processing of this file (with this specific name) is handled by the ASP.NET runtime rather than IIS itself (for IIS v6).
Be aware, however, that although placing this file in the root of your site will force the application to "shut down" and display the content of the "app_offline.htm" file itself, any existing requests will still get the real website served up to them. Only new requests will get the app_offline.htm content.
If you're still having issues, try the following links for further info:
Scott Gu's App_Offline.htm
App_Offline.htm and working around the "IE Friendly Errors" feature
Will app_offline.htm stop current requests or just new requests?
Make sure your app_offline.htm file is at least 512 bytes long. A zero-byte app_offline.htm will have no effect.
UPDATE: Newer versions of ASP.NET/IIS may behave better than when I first wrote this.
UPDATE 2: If you are using ASP.NET MVC, add the following to web.config:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
Note that this behaves the same on IIS 6 and 7.x, and .NET 2, 3, and 4.x.
Also note that when app_offline.htm is present, IIS will return this http status code:
HTTP/1.1 503 Service Unavailable
This is all by design. This allows your load balancer (or whatever) to see that the server is off line.
Possible Permission Issue
I know this post is fairly old, but I ran into a similar issue and my file was spelled correctly.
I originally created the app_offline.htm file in another location and then moved it to the root of my application. Because of my setup I then had a permissions issue.
The website acted as if it was not there. Creating the file within the root directory instead of moving it, fixed my problem. (Or you could just fix the permission in properties->security)
Hope it helps someone.
Make sure that app_offline.htm is in the root of the virtual directory or website in IIS.
Make sure filename extensions are visible in explorer and filename is actually
app_offline.htm
not
app_offline.htm.htm
I ran into an issue very similar to the original question that took me a little while to resolve.
Just incase anyone else is working on an MVC application and finds their way into this thread, make sure that you have a wildcard mapping to the appropriate .Net aspnet_isapi.dll defined. As soon as I did this, my app_offline.htm started behaving as expected.
IIS 6 Configuration Steps
On IIS Application Properties, select virtual Directory tab.
Under Application Settings, click the Configuration button.
Under Wildcard application maps, click the Insert button.
Enter C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll, click OK.

Resources