Local debugging of subdomains with VS 2015 - subdomain

I have a multi-tenant website that has to take care of any incoming request and determine the appropriate routing by the URL subdomain.
I set up the subdomain routing using this or a similar solution.
However I'm trying to access my website on my local machine using subdomains an alias website. I'm unable to get my local IIS to port to my website with the subdomain I've specified.
I want to dedicate a virtual domain name in my local machine that will port to the website I'm debugging on VS (localhost:23456).
I've read some answers of identical questions (like this or this one), but it looks like the system has changed with the new IIS and Visual Studio 2015 and ASP.NET 5 MVC 6 (vNext) project configuration.
Here's what I've tried according to the answers linked above:
I tried setting the hosts file porting www.myexample.com to 127.0.0.1 but I get a "Bad request" error when navigating to www.myexample.com:23456 in my browser, and anyway the debugger doesn't report a request.
I tried setting <binding protocol="http" bindingInformation=":23456:www.myexample.com" /> in the applicationhost.config file, gets IIS to raise an error saying "Replace hostname with localhost. Any other bindingInformation not specificying localhost as the website raises that IIS error.
Update
After opiants answer
I knew about the .vs folder and that's were I was configuring the bindings indeed.
However, looks like it was the permission that caused IIS to throw errors.
Running that netsh command solved the issue. And BTW, since I'm only running it my own machine, I'm not gonna need to open the firewall.
Anyway my question is if there is a way to add a wildcard instead of each subdomain separately? Since each tenant gets a unique subdomain, the whole process of adding subdomains is going to be dynamic by nature. I need to allow an asterisk in all the 3 places:
hosts file
applicationhost.config file
netsh command
It looks like I can add the asterisk in those places but it doesn't actually work.

I'm guessing you're using IIS express locally?
If so, in your solution directory, there is a .vs folder. You need to add the binding in the \config\applicationhost.config file inside that folder. Then make sure that you've allowed IIS express to listen to that subdomain.
You can refer to Scott's article on how to configure IIS Express. Specifically look for this paragraph "1. GETTING IIS EXPRESS TO SERVE EXTERNALLY OVER PORT 80"
To be more specific, you need to run these commands:
netsh http add urlacl url=http://{your-domain}:{custom-port}/ user=everyone
netsh firewall add portopening TCP {custom-port} IISExpressWeb enable ALL

Related

Can not display drupal console and phpmyadmin on local host at same time

I am absolute beginner on Drupal, and nearly that on setting up localhost on my Mac along with MySql. My problem is I can't display Drupal and run phpmyadmin on separate tabs in my browser at the same time. I found that changing the 'AllowOverride' parm in my http.conf file will allow one or the other to work, but not both at the same time.
So in etc/apache2/httpd.conf <Directory "/Library/WebServer/Documents"> section:
If use 'AllowOverride None'
Can get to http://localhost/phpmyadmin/index.php
Cannot get to http://localhost/user/login (get 'The requested URL /user/login was not found on this server')
If use 'AllowOverride All'
Can not get to http://localhost/phpmyadmin/index.php (get 'You don't have permission to access /phpmyadmin/ on this server.')
Can get to http://localhost/user/login
Any ideas?
AllowOverride should be set to "All" since that way you are allowing .htaccess file to work properly (i.e. do redirections and make pretty urls work).
If phpMyAdmin is not working with that setup that means that Drupal's .htaccess rules are catching your requests to phpMyAdmin. That probably means that you installed Drupal directly inside web root and phpMyAdmin inside it's one directory (as a sub-site of Drupal). So even you are calling phpMyAdmin Drupal jumps in and takes control of that request.
One solution would be to install Drupal inside it's own directory, so you could access your project as i.e.
http://localhost/drupal
That way Drupal's .htaccess file will be inside drupal dir and not in web root dir.
Other solution would be to create virtual hosts, so depending on used domain web server would know which site to display (to serve request from which directory).

Google Chrome remote debugging local domain

I'm developing a website on my local machine using myblog.local as a custom domain for that, I have an apache VirtualHost and the name registered on the hosts file of my mac. The thing is when I try to use chrome remote debugging on my USB connected device using myblog.local as an address pushed using the chrome://inspect tool.
I always a not found error.
My question is, do I need to do something extra in order to remotely debug a custom domain registered on my Mac?
Check out Map to custom local domains.
I got it set up once to work with custom local domains, but it took a bit of experimenting. I definitely needed a proxy server to get it working.
I had exactly the same problem on a PC. I followed #Kayce Basques' Map to custom local domains guide and after some perseverance everything is now working.
Kayce's guide requires a proxy server, I've included my working configuration for the Squid open source and free proxy server below.
Squid installation was easy, I just downloaded and installed a pre-compiled Windows binary file and the server appeared in my Windows system tray. It should hopefully be equally simple for OSX and Linux platforms.
All configuration is done inside a squid.conf file accessible from the Squid menu. I followed this simple guide for a Reverse Proxy. Whilst I included everything in that guide I believe the following line is the critical one to get everything working.
cache_peer 192.168.0.2 parent 80 0 no-query proxy-only originserver
In the above line 192.168.0.2 is my PC's internal IP address and 80 is my Apache virtual host port number defined in my Apache Virtual Hosts file. There's another helpful guide here but that guide omits the originserver option and didn't work on my machine though otherwise helpful.
It seems you do need to be connected by USB cable for this to work so I don't quite understand #asolenzal's comment above. Also each time I changed the configuration I ran Path/to/squid.exe -k reconfigure -n Squid in a command window to reload Squid. You can find that command here.

PhpStorm - working on a remote server

I have never used PhpStorm before for remote development because I used to work locally.
I am wondering if there is a method to set PhpStorm to work in such a way so it will be identical, in terms of functionality, to local development?
At least, debugging and jumping to functions/variables declaration across the whole project?
Tried to google it but found nothing. Maybe someone knows?
There are two ways to work with remote server development :
With a physically server
With a Virtual Machine locally
Those 2 ways are identical workflow parameters for working with this.
In PHPStorm the main area for parameters workflow deployement on remote server is : PHPStorm > Settings > Build, Execution, Deployement > Deployement
In this area you config the connection on your remote server (you before must config access on your remote server). SFTP is the best way to use this connection.
Most important to select where you want to send/push your modified code with Root path. Upload manually or use the sync auto functionality of PHPStorm use this parameter.
Mappings tabs is not very important you can keep this without change except for 'Deployement path on server' which just type '/' character if you have selected the good 'Root Path' in tab before.
For starting you can forget the Excluded Paths tab. after if you work on symfony framework you use this to exclude the vendor directory.
Don't forget to set the options 'use as Default' if you want to upload or sync auto more fastly and friendly.
Now you must parameters and config correctly your remote server for server be able to run the code which send it with PHPStorm. Dependly on your framework or other technologies you use.
Finally you have :
PHPStorm config OK for send correctly your modification code (auto or manually)
remote server config OK for executing and running correctly the code you are before sending from PHPStorm to your server remote
WARNING : you never run your website into your local OS.
IMPORTANT : config a web server on your remote server and don't forget to install layer for PHP executing script.

Hosting basic html site on iis

I have a basic web site (just html, js and css files) that I want to host on IIS on my local machine for testing purposes. The site runs fine when I run it directly as a file on my computer. I added a website on IIS, using the directory these files are located in, but when I try to launch it, I get an error page that says:
An error occurred loading a configuration file: Failed to start monitoring changes to '[my site path]' because access is denied.
It then says that the source file is a web.config. I know that ASP.NET sites use a web.config, but I don't even have one, and I just want to run a basic site using html, css, and javascript.
Any ideas on what the fix might be? I made sure I have an application pool for the site.
You likely put it into your user profile -- ie c:\users\skitterm\ -- which won't let the process running IIS read the folder. You are better off using IIS' built in directory structure in c:\inetpub and adding a folder for your site.
As you can tell this is a server misconfiguration. It would help to know the version of your IIS.
You can follow the steps on Microsoft's official knowledgebase to resolve the issue:
http://support.microsoft.com/kb/316721
http://support.microsoft.com/kb/317955 (for IIS v6.0, try Method 3)
I worked in IIS about a year ago and such errors are caused by misconfigured Security settings in IIS.
Sounds like you need to set up the proper access rights for the folder to the account specified by the application pool identity.
First make sure that your folder is not anywhere under your \users\, \program files\, or any other place that already has restricted access. Put it under a folder on the root (\inetpub is a good place).
Then, add the appropriate permissions (usually read only) for the folder to allow the user account specified by the app pool identity to access it. If the app pool identity is set to ApplicationPoolIdentity, adding the IIS_IUSRS local group should do it. Otherwise, use the account that is specified.
This should fix the problem.

unsupported address error when trying to access page on specific port in a LAN

when I try to access a page on my IIS Express in a LAN (e.g. 192.168.1.123:3766/Host/MyPage.aspx) from my HTC 8S with Windows Phone 8 I get an error message that says "Unsupported address Internet Explorer Mobile doesn't support this type of address and can't display this page.
Is it possible to get this to work and if so how?
You need to specify the protocol. Try http://192.168.1.123:3766/Host/MyPage.aspx.
You will also need to follow the instructions here to make sure that your IIS Express is serving up on a port which your phone can see.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580(v=vs.105).aspx
In particular follow this section:
Quick solution with IIS Express
Create a firewall exception to allow HTTP requests through the firewall on the port that IIS Express is using.
Get the IP address of the development computer, if necessary, by running ipconfig.
Find the IIS Express configuration file, applicationhost.config, in the folder %USERPROFILE%\Documents\IISExpress\config. The USERPROFILE environment variable typically has a value of C:\Users\.
Open applicationhost.config with Notepad or another text editor and make the following changes.
a. Find the site element for the web service, WebServiceForTesting.
b. If you don’t see the site element for the web service, you have to deploy the service at least one time to create the element.
c. Within the bindings section of the site element, copy the binding element and paste a copy directly below the existing binding element to create a second binding.
d. In the new binding element, replace localhost with the computer’s IP address.
Save the changes.
Run Visual Studio as administrator and open the Visual Studio solution.
And beware of:
Important Note:
On a corporate domain, the emulator appears as a separate network device that is not joined to the domain. As a result, you may also have to get an exception from your IT department before the emulator can connect to services that are running on the domain-joined development computer.