Sorry if this is an easy question or solution can be found easly but I can not find it. Unfortunatelly on web finding what you need about Azure is nearly impossible for me as because maybe I don't know how to search because I am a very beginner level web programmer and just started mobile and Azure.
I started native Android development with .Net backend and begin with the tutorial on Azure web page. Now I have the service and mobile app up and running with out any problem. But I can't run and debug it locally. I downloaded the service and when I run it a web page is opened with "http://localhost:59220" address. My machine and phone that I am using for testing is on the same network. I configured my firewall and can telnet it. But phone can not connect to it. Also I can not connect to web page from phone or another computer on the same network. When I try with "192.168.1.100:59220" adress "I got Bad Request - Invalid Hostname HTTP Error 400" error both from phone other computer and also from the computer that runs the service. But when I change ip to localhost it works.
How can I connect my phone and debug my todolist service while running on local?
Thank you.
The answer of urig is the solution that I was looking for but a little addition is needed. If you are using VS2015 applicationhost.config is located on "solution folder of your project".vs\config folder.
Your phone cannot access your local server as "localhost". This hostname is mapped to IP address 127.0.0.1 and on your phone that address points to the phone itself and not to the computer you're running the website on.
When you try with 192.168.1.100, your request does reach the local server and is most likely received by IIS Express - the web server built into Visual Studio which runs your project by default.
IIS Express, however, responds to your request with a Bad Request - Invalid Hostname HTTP Error 400. That is because "192.168.1.100" is not a hostname it is familiar with.
To get a proper response you will need to configure IIS Express to accept requests from 192.168.1.100 or some other hostname. Below are instructions on how to do so, adapted from this blog post: IIS Express – HTTP Error 400. The request hostname is invalid.
Exit the IIS Express instant currently running.
Open IIS Express’s applicationhost.config located at the following path C:\Users\<user>\Documents\IISExpress\config\applicationhost.config
Find the entry for a particular site (e.g “Azure Todo List” running in port 59220) which you are developing.
e.g.:
<site name="AzureTodoList" id="10">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\Projects\BB Apps\AzureTodoList" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:59220:localhost" />
</bindings>
</site>
Replace bindingInformation="*:59220:localhost" with bindingInformation="*:59220:*"
Note: This will make your website ignore the hostname when it responds to requests. This is not the most secure thing to do.
Save the file.
Start a command prompt in administrator mode and run the following command.
netsh http add urlacl url=http://*:6306/ user=Everyone
Now debug the site again and you should be able to access the url using IP address or host name.
Related
How to access local postgreSQL server running on computer, from mobile my phone?
I am making flutter app and use pgAdmin v6.10 as local server. I'm stuck for 2days trying different solutions to access server from my mobile browser but no progress.
I believe if i can access local server through mobile browser, also i can send data from my flutter app to database.
My pgAdmin runs on pc browser nicely but on phones browser doesn't open,
I've tried addresses 192.168.43.12:port(i.e computer's ip:port number) and 127.0.0.1:port
but they all didn't work, i get ERR_CONNECTION_REFUSED
Also i added this line on pg_hba.conf file
TYPE DATABASE USER ADDRESS METHOD
host flutterdb flutterdb_admin 192.168.43.12/24 scram-sha-256
And on my postgresql.conf file there is
listen_addresses = '*'
I'm following tutorial series from: https://youtu.be/WFe1kZhvUIw
I need your help please.
NOTE: I am using Windows laptop
i think that if u have dev environment, just you can try to open the connection..
you can try to configure for accept all connections
How to configure PostgreSQL to accept all incoming connections
I have an ASP .Net Core 1.1 Web API and Web App running on my localhost from Visual Studio 2017 on Windows 10.
When I run the projects, the API runs on http://localhost:50082/api/ and the web app on http://localhost:60856/
However, if others on the LAN try to access it (using my computer's IP address - http://192.168.1.101:60856/ they get a
Bad Request - Invalid Hostname
Error. In fact,. I get this error too of I use my IP address. I've tried about a dozen variations in my C:\Users\Documents\IISExpress\config\applicationhost.config file, such as:
<bindings>
<binding protocol="http" bindingInformation="*:60856:localhost" />
</bindings>
and
<bindings>
<binding protocol="http" bindingInformation="*:60856:" />
</bindings>
restarting the projects (and therefore IIS Express) every time, but nothing seems to work. Any ideas?
IIS Express does not allow remote connections by default. This post explains how to activate it.
In my opinion, you would be better off if you setup local IIS and publish the app to the configured IIS folder.
I already tried HTTP.SYS configurations for other situations, and sometimes the configs are lost whether on restarts or windows updates... But this may not happen to you...
If you are using asp core, another solution is to simply change your profile from 'IIS' to 'Standalone' (which is named as your project) from Visual Studio toolbar:
By this change, IIS will not run anymore and the embedded asp web server 'kestrel'
will face the requests directly.
If it's still give you host invalid error adjust your hostname settings by adding this line to your config file:
"AllowedHosts": "*",
More info:
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/?view=aspnetcore-5.0#set-up-a-reverse-proxy
https://weblog.west-wind.com/posts/2019/Mar/16/ASPNET-Core-Hosting-on-IIS-with-ASPNET-Core-22
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/host-filtering?view=aspnetcore-5.0
I had this same issue trying to get ngrok to point to a local ASP.NET Core website.
This guy's answer worked for me: https://kodlogs.com/blog/532/iis-express-http-error-400-the-request-hostname-is-invalid
Basically, in the [solution dir]\.vs\[asp.net core web app dir]\config\applicationhost.config file, change the line from:
<binding protocol="https" bindingInformation="*:[your port]:localhost" />
to:
<binding protocol="https" bindingInformation="*:[your port]:*" />
We have a Flex/Flash application that loads information from XML files created by a .NET application. It works fine under IIS but when I try to run it from Visual Studio 2010 or 2012 using the ASP.NET Development Server, the Flex/Flash app isn't loading the information. I brought up Fiddler and am able to see that there's an error occurring when the Flash tries to access the XML:
[Fiddler] The socket connection to localhost failed. ErrorCode: 10061. No connection could be made because the target machine actively refused it 127.0.0.1:80
I've turned off my Firewall but that didn't help. So, I'm not sure where the block is occurring. Any thoughts?
[Update: switched from Asp.NET Development Server to IIS Express and am still getting the exact same error.]
[Update2: I've verified that the XML file the Flash is trying to reach comes up fine in the browser: http://localhost:63318/ProductDetailsXML.aspx?ProductId=71]
It may have to do with it being served off of a specific port (not 80). How is your application requesting the XML file? According to your Fiddler log, it's trying port 80, but your site is running on port 63318.
With VS 2010 Web Deploy is functional and working without issue. At the same time, Web Deploy from VS 2012 fails, indicating that the server did not respond and suggesting this link.
This notes the following conditions, all of which are fulfilled.
You can ping the remote machine
That the msdepsvc or wmsvc service is started on the remote server.
Your firewall is not blocking incoming connections of your ports on the destination. If you used the default installation, then it would be 80 for msdepsvc and 8172 for wmsvc
Web Deploy is still functioning for VS2010.
How can this be solved?
Clearly an example of not reading all the documentation first. However, for those looking to understand some of the changes here's what I found.
VS 2012 uses the Web Deployment Agent Service and NOT the Web Management Service
Local deployment is to "http://Your Server/msdeployagentservice" and NOT :8172/msdeploy.axd
For a complete account of the many options GO HERE!
Hope this helps someone else.
I've installed Web Deploy 2.1 on a Server 2008 R2 running under VMWare.
In the IIS Manager (Management Service applet) I can see that "Enable Remote Connections" is checked and the port is set to 8172. Under "IIS Manager Permissions" I've added my Windows account (CORP\ekkis) and under the "Authentication" applet (for IIS) I have enabled "Windows Authentication".
I've also turned off the firewall.
So from the command line I test the system to work like this:
C:\Program Files\IIS\Microsoft Web Deploy V2>msdeploy -verb:dump -source:contentPath=\temp,wmsvc=192.168.0.70,username=CORP\ekkis,password=MyPass,authType=Basic -allowUntrusted=True
and get this:
Info: Using ID '9b954a0f-ff07-4e77-ba2c-d27472f5fda0' for connections to the rem
ote server.
Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the destination computer ("192.168.0.70") using t
he Web Management Service, but could not authorize. Make sure that you are using
the correct user name and password, that the site you are connecting to exists,
and that the credentials represent a user who has permissions to access the sit
e.
Error: Object of type 'contentPath' and path '\temp' cannot be created.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
I've also tried deploying with Visual Studio 2010 from the host OS with the following service urls (I haven't found proper documentation on how to form this url):
https://192.168.0.70/
https://192.168.0.70:8172/
https://192.168.0.70:8172/MsDeployAgentService/
https://192.168.0.70/MsDeployAgentService/
I've tried the non-secure versions as well but just cannot get it to work. What is the correct format for the url? and what permissions am I missing?
the errors from VS have varied depending on how I attempt it but below is a sample:
Could not complete the request to remote agent URL 'http://192.168.0.70:8172//MSDEPLOYAGENTSERVICE'.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Publish failed to deploy.
there really should be a guide out there to do this (yes, I've googled myself blue in the face)!
thanks - ekkis
ok, I've figured out that the correct url is:
https://192.168.0.70:8172/MsDeploy.axd
and that having the "Windows Authentication" enabled doesn't seem to make a difference. Also, having my account in the "Managers" list doesn't seem to make a difference either.
so the back end was all working fine (I've turned off the Web Deployment Agent Service). it was just the url I had wrong.