VirtualPathProvider Not Working on Hosting Environment - iis-7

My .Net project works fine on Local IIS7 (Windows 7 IIS7 x86). But it does not work on hosting environment (W2008 Server x64 IIS7). I can fully control hosting environment. But I could not locate the error. When working locally I can access the USer Controls in the DLL via VirtualPathProvider, but i receive error
The file '/TarimWeb/TarisApp/TarisUI/CariBanka.ascx' does not exist.
on hositng environment.
I can provide any information, but i do not know what my helper would need to know.
Thank you!

So, I totally forgot that "PreCompiled Web Sites" cannot use VirtualPathProviders.
I found a work around # http://sunali.com/2008/01/09/virtualpathprovider-in-precompiled-web-sites/
It DID work for me too...

Related

Local Host redirected you too many times Issue with IIS

I am working on bringing a working web application onto a new computer running Visual Studio 2022 version 17.4.2 and .NET Framework 4.7.2. When running on local IIS (version 10.0) host there is a "local host redirected you too many times" issue. It suggests clearing cookies which has been done with no effect.
The same code works on other machines with no issues. Is there anything in IIS set up/configuration or that may be missing from Visual Studio or other installations? Thanks in advance.
So far we have tried debugging the code and including breakpoints for where the issue may be occurring, ensuring that the installations of windows feature and IIS management is the same as another where the program is working. Also created a .txt file that can be reached on local host and is in same location as the rest of the project.
Here are a few things you can try:
Try on another machine.
Try to remove as much rules as possible from web.config and keys and so on. Or if it's a single page you're having the error with try to remove as much code from it especially if there are redirect codes. And add breakpoints and debug.
Check the LOCAL application pool version if it's set same as the online .net framework version.

Problems publishing site to localhost on windows 2008 rs server

I must preface this post by saying that I am not an experienced developer, I am in the process of learning through trial and error and a lot of google searches so detailed (step-by-step) feedback would be greatly appreciated. I created a website, which does not use a database, using visual studio 2015 and I am attempting to host it locally on a Windows 2008 R2 server.
I installed IIS and loaded the asp.net v4.0 framework. The site works fine, produces no errors when I test it and works after being published only if the visual studio is still running.
However, when I close the Visual studio and open my browser window to http://localhost:50044 (which is the URL listed in properties menu in VS), I also tried using port :80 and nothing. When trying to add Web Site via the IIS management utility I receive the following authentication error: ”Cannot verify access path (C:\Inetpub\wwwroot).”
I checked the permissions and windows authentication is enabled with read access, and all other permissions seem to be correct. I am at a loss, I'm sure it is probably something simple that I am missing due to my lack of knowledge and experience. Any help would be appreciated.
It's sounds like you are running on IIS express which in your case stops running when you close visual studio. Normal process is create a new website in IIS and point to the folder where your web.config is. You can then hack your host file (C:\Windows\System32\drivers\etc) so DNS works. Add an entry like "127.0.0.1 mytestwebsite.com". I hope that helps
So I figured out part of what was happening. I didn't realize that visual studio has built in IIS and was using that by default.
I ran VS as an admin, created a new project, then attempted to create a virtual directory thru VS under the project/properties/web tab. I selected local IIS and entered http://localhost/boc and it returns an error: unable to create vd. Web server http://localhost... Could not be found.
I then went in to the IIS manager and set up a virtual directory with no issues. However, when I attempt to reference it thru VS I again receive an error message.
Any ideas?

Permissions problem when accessing remote files from my Web Service

My web service needs to open some files located on a remote computer.
From Windows I can do the authentication so I can see those files using the File Explorer.
If I try to open the files from my Web Service while it's running using Visual Studio (ASP.NET Development Server) it also works.
However, if I do everything from IIS it doesn't.
In order to find out where is the problem what I did was to run a network sniffer and I found out that when using IIS, the system will try to use the account 'ASPNET' to login into those remote computers which will obviously fail.
However this doesn't happen if I run from the IDE (Using the ASP.NET Development Server)
I found out that if I use Impersonation for accessing this it will work, the problem is I need to have the same account names on the computer running IIS so I would rather not to do that.
Why is it working from the ASP.NET Development Server and not from IIS? Is there a way to give full access to the ASPNET account?
Thanks and hopefully somebody will be able to help with this. I don't know what else to try...
Any request on IIS is served by the ASPNET user. So the user ASPNET is working. I think you are using XP. On Win2K3 etc, the user is Network Service
But the Cassini (Visual Studio Dev server) runs under the current logged in user.
So the difference is. You need to use impersonation for your need.

Using Elmah with Cassini

Does anyone know if I can use Elmah with Visual Studio build-in web server(aka Cassini)?
I get it working easily on IIS, but using same configuration, it doesn't work with Cassini. When I requested the log page via http://localhost:62364/elmah.axd, I had "The resource cannot be found."
I can't give any insight to what's causing your issue, but I can say that it works fine for me both in Cassini running on localhost and deployed to IIS.
If you're using an x64 version of ELMAH you will run into configuration problems, as outlined here: Could not load file or assembly 'System.Data.SQLite'

How can I copy files with ASP.Net using Vista and IIS7?

I have a button on a website that creates a directory and copys a file. I developed it using Visual Studio 2008, ASP.Net 3.5. I am running Vista as my OS. The website uses identiy impersonation.
The functionality doesn't work ("Access to Path XYZ is denied") when:
I run the website via IE hitting the local webserver
The functionality works fine when [note Visual Studio run with Admin rights]:
I hit play in Visual Studio
I say view in Browser from Visual Studio
I run the website via IE hitting the local webserver, but start IE with Admin rights
I deploy the website onto another webserver (also vista/IIS7)
I modify FireFox to accept integrated authentication, then access via FireFox and localhost
I've never seen this behavior before, previously File.Copy type commands only cared that the rights on the folder being copied to were valid etc... (I have Everyone having full control while trying to debug this situation). It seems likely that the issue is having Admin rights or not? Or being logged in to the machine that it is running on?
What is happening here? Why does it work in the development environment and deployed to another machine, but not work when deployed on my own machine? Seems very odd, any help would be appreciated.
EDIT: I've added "Everyone" to all of the relvant directories and give that user Full Control, so there shouldn't be any permission issues?
You should try giving permission to modify over asp.net
you can find several articles about that by google(ing) it.
More likely the user that IIS is running impersonated thread under does not have access to the original file or the destination. Have you tried doing the copy directly as that user? When you run IE as administrator or running VS as administrator the impersonated user has full rights as admin.
[Edit - add link]
There is some info on a similar thread, the idea to use SysInternals was good:
UnauthorizedAccessException with IIS7
OK I have tracked down the solution to this issue given these symptoms. I'm not 100% sure why this works (particularly since it works fine in FireFox and works fine in IE if you not connecting locally), but the following seems to be a work-around.
In IE select Tools -> Internet Options -> Security -> Trusted Sites -> Sites and add http://localhost as a trusted site. This then enables you to use the website locally. Why you need to do this in IE when connecting locally and not in FireFox or IE when connecting to another machine is something I don't know. But it does seem to be a viable workaround.
My guess is the identity ASP.Net is running under doesn't have permissions (NetworkService) or the user used for anonymous authentication does have permission (IUSR)

Resources