Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Genymotion view localhost site

I am building a website, and I would like to see how it is rendered on an Android Smartphone, so I downloaded Genymotion. I can't see any pages on my local site from Genymotion ("Bad request - invalid hostname").

When I launch the Visual Studio solution, the homepage address is

http://localhost:18207

so following the advice that I found for example here I typed in Genymotion the following addresses:

http://10.0.3.2:18207

http://192.168.56.1:18207

http://(my ip address):18207

but I always have the above mentioned error, or sometimes a timeout error.

Thanks a lot for any suggestion!

like image 492
Sean Avatar asked Mar 20 '23 00:03

Sean


1 Answers

I ran into this exact same issue and resovled it with the help of this blog post:

http://blog.binarybits.net/applications/iis-express-http-error-400-the-request-hostname-is-invalid/

I don't want to take any credit for the content of that post, but just in case it goes offline I'll lay out the process. Essentially you need to update the configuration for IIS Express so it'll accept the incoming request from Genymotion. So assuming that your site is running on port 8080:

Step 1 - Modify the specific configuration for your site in C:\Users\\Documents\IISExpress\config\applicationhost.config so it's tied to * instead of localhost

<site name="WebSite1" id="1" serverAutoStart="true">
 <application path="/">
  <virtualDirectory path="/" physicalPath="PATH TO YOUR SITE" />
 </application>
 <bindings>
  <binding protocol="http" bindingInformation=":8080:*" /> <!-- CHANGE THIS LINE -->
 </bindings>
</site>

Step 2 - Add an ACL rule to let incoming connections access your laptop on this (run this command via admin)

netsh http add urlacl url=http://*:8080/ user=everyone

Step 3 - Finally connect to your site within Genymotion using this special address

http://10.0.3.2:8080/

That worked for me, so hopefully it works for you as well.

like image 172
Sam Storie Avatar answered Mar 29 '23 18:03

Sam Storie