loose folder in web site - asp.net

i updated a website with asp.net and c# from framework .net 2.0 to 4.5.1. (I'm using VS2013 Professional Update 4).
I've rebuilded and resolved all errors; (now there are no errors or warnings).
But when i started debug i noticed i loose something:
the complete address
http://localhost:2201/WebSiteName/folder/filename.aspx
became
http://localhost:2201/folder/filename.aspx.
it isn't possible to update virtual url in a web site (only in a web application).
I don't understand if it depend from new web browser (IIS Express in VS2013).
Can you help me?
Thanks

VS2013 uses IIS Express 8.0 and set as main default root the website folder (i mean the real folder where we made our site).
to use this folder in the url you change:
c:\user[username]\documents\IISExpress\config\applicationhost.config
and to find block tag who refer to the website.
copy tag "Application" set new values.
L'applicationPool is set to "Classic" for WebSite while "Integrated" for the WebApplication.
<site name="Prova" id="5">
<application path="/" applicationPool="Clr4ClassicAppPool">
<virtualDirectory path="/" physicalPath="E:\prova" />
</application>
<application path="/MyRoot" applicationPool="Clr4ClassicAppPool">
<virtualDirectory path="/" physicalPath="E:\prova/myRoot" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:2001:localhost" />
</bindings>
</site>

Related

Properly handle angular route from a different virtual directory at server level

I have two virtual directories in an IIS site.
One is used for a asp mvc web api application.
The other one is used to serve an angular 4 SPA.
The SPA rely on the web api application for its data.
We use the dist output of #angular/cli for the SPA content that is used as the physical path to the second virtual directory.
I'm looking for a way to catch angular routes directly forwarded to the server (i.e.: before the angular app has loaded client-site).
For the sake of clarity, here is my two applications as configured under my site in my applicationhost.config :
<site name="MySite" id="9292">
...
<application path="/spa" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\angularApp\dist" />
</application>
<application path="/webApi" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\webApiAspMvcApp" />
</application>
...
<bindings>
<binding protocol="http" bindingInformation="*:9292:localhost" />
</bindings>
</site>
Saying I have the following angular route configured in my angular application : "about/company", I'm looking for a way to handle the call to http://localhost:9292/spa/about/company, for IIS not to try serving static content at this location.
Of course the real static content as-used by the spa should still be served by IIS.

VS 2015: Binding a WebApp to something besides localhost

I've got an VS WebApp I am testing (An OData Provider if it matters). The client is Android.
You can't run the server and client (via a simulator of the client' OS) on the same box.
So I'm using a physical Android device to run the client. Unfortunately Visual Studio is hell bent on binding the webapp to (and only to) localhost. It isn't won't respond to attempts to connect to the hostname or IP address, and any attempt to change the IIS configuration inside of Visual Studio meets with an error message saying you specifically must use localhost (which obviously cannot be used to connect to from a another machine)
1) How do I get around this?
and
2) If this isn't obvious to find, how are people are expected to test from a remote device on their development machine?
JoeHz,
You need to change the binding configuration of your IIS Express for your WebApp.
In the folder where your *.sln is, find the hidden folder named .vs. Then open the xml file applicationhost.config in the config folder.
In the applicationhost.config file, find the sites nodes, then the site you want to configure.
For example:
<site name="MySiteName" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\MyDirecctory" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:8381:localhost" />
<!--Add new binding here with ip address-->
<binding protocol="http" bindingInformation="*:8381:192.168.0.10" />
<!--or add new binding with machine name-->
<binding protocol="http" bindingInformation="*:8381:MachineName" />
</bindings>
</site>
Once the file saved, make sure your IIS Express is closed and start your website. Once IIS Express started, check if the new binding worked, you should see something like this:
Ensure you can access the website in your web browser, not with localhost, but this time with your new binding like http://192.168.0.56:33617.
If all is good, then go to your Firewall, and add a new TCP rule for the port you need to open
When done, at that point any device on the same network should be able to access the website. Try the new address on your Android device web browser.
Your Android client should now be able to access your WebApp.

VS 2013 / IIS Express - serve site from localhost:port/myapp instead of localhost:port

In prod my site (mvc5) is hosted on https://company.no/myApp/ where myApp is an Application on IIS.
In dev my site is hosted on IIS Express on http://localhost:54307/
As this causes some truble with server relative paths I would like to also do my debugging on http://localhost:54307/myApp.
This is what I've tried:
Setting project url in property pages to http://localhost:54307/myApp and clicking Create Virtual directory
Tried the override application root with or without the myApp url.
Tried modify the applicationhost.config. Currently my setting looks like this:
<site name="MyApp.Web-Site" id="38">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\OP\MyApp\Main\src\MyApp.Web" />
</application>
<application path="/MyApp" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\OP\MyApp\Main\src\MyApp.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:54307:localhost" />
<binding protocol="https" bindingInformation="*:44307:localhost" />
</bindings>
</site>
When I try to open page from the myApp folder I get the follownig error:
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x800700b7
Config Error Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'WSFederationAuthenticationModule'
Config File \\?\C:\Projects\OP\MyApp\Main\src\MyApp.Web\web.config
Requested URL http://localhost:54307/MyApp
Physical Path C:\Projects\OP\MyApp\Main\src\MyApp.Web
That indicates web.config loaded twice. Any idea what I'm doing wrong?
Thanks for any help
Larsi
I hear you with IIS Express causing problems with server relative paths. You can set this up with a couple steps that don't include manually editing your applicationhost.config. I try to avoid editing the applicationhost.config manually, it seems to cause more problems than it solves. I would remove the website from your local IIS to clear out any of that stuff and then do the steps below:
right-click on your web project and select properties.
Click on the "Web" menu
change the dropdown to Local IIS and enter the URL you would like the app to resolve to then click create virtual directory, save the file and build.
You can still debug without the port number, the debugger will just attach to this new website in your local IIS instance as long as you have a debugger option checked on the web tab.
open your local IIS and make any other configurations that are required for your app to run (Authentication, Application Pools, etc.).
open your browser and navigate to http://localhost/YourAppName
since this is a website as far as your local iis is concerned, you can hit it anytime in a browser without needed Visual Studio running.

How to view a asp.net mvc web application in another computer based on its IP address?

I wan to open my asp.net mvc website in another PC by using: "http://163.155.xxx.xxx:49397"
I added these codes in my iis applicationhost.config file, but this does not work, any idea?
<site name="PerfM" id="3">
<application path="/" applicationPool="PerfM">
<virtualDirectory path="/" physicalPath="C:\Users\Documents\Visual Studio 2012
\Projects\PerfM\PerfM" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:49397:163.155.xxx.xxx" />
</bindings>
</site>
I think your bindings may need to be configured quite right.
<binding protocol="http" bindingInformation="*:49397:" />
<binding protocol="http" bindingInformation="163.155.94.115:49397:" />
Try the above. If not maybe try modifying it ussing IIS manager.
You should also disable windows fire wall or open port 49397 for access via HTTP. By default this port will be blocked.
How to turn windows fire wall on and off. I suggest you turn off the fire wall first. That will eliminate it as a potential problem. Once you have the site working from another computer you can try to turn it back on and open a port. Here are some instructions on how to open a port.

System.UnauthorizedAccessException when accessing a custom database connection DLL

I'm having issues with vs2010 debugger. I have an application that uses a forms log-in then uses a custom connection .dll to connect to the database. The web application seems to run as expected when accessing it straight through IE, but when I use the debugger it throws a System.UnauthorizedAccessException trying to access the connection DLL located in the GAC. It seems to be a permissions problem for the user that the debugger uses. This is a little outside of my scope of knowledge.
Here is my iis7 settings
<applicationPools>
<add name="DefaultAppPool" autoStart="true" managedPipelineMode="Classic" startMode="OnDemand">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" pingResponseTime="00:05:00" />
</add>
Application Set up on server
<application path="##AppName##" applicationPool="DefaultAppPool">
<virtualDirectory path="/" physicalPath="##APP Path##" />
</application>

Resources