Is it possible to change the url called by WAMP? - port

When click 1 and/or 2 WAMP open the web without my configured IP
i.e.
1 open http://localhost/, I need localhost:8080
2 open http://localhost:8080/phpmyadmin/, I need localhost:8080
Is it possible to add the port in WAMP's configuration somewhere? Currently I add it manually.
Thanks to JK suggestion I've try and found that in wampmanager.tpl file, search for localhost will expose the marked-red area which help to add the port.

Navigate to your WAMP installation folder and locate the files wampmanager.ini and wampmanager.tpl. Replace all occurrences of localhost with localhost:8080 within these two files. Restart wampserver.

Actually, #JK, the wampmanager.tpl is the template file used (by wampmanager.exe during start up) to generate wampmanager.ini. So you only need to edit the .tpl file and that solves it.
*TIP: You can also add custom menus to your wamp tray icon by adding entries to the wampmanager.tpl file.

Edit the file C:\wamp64\wampmanager.conf and change the port:
[apache]
apachePortUsed = "8080"
Then exit and relaunch wamp.

Related

OwinHost.exe from command line - how to make it start on a different port?

Yes, I have looked on google for this seeming simple question w/o much luck.
So my project includes the OwinHost (OwinHost.exe) NuGet package, and this has updated my project in such a way as to allow the Visual Studio IDE, via property pages, to specifically launch OwinHost.exe using whatever url:port I've specified on the 'Web' tab.. .. but since this is currently error-ing out and closing the cmd window before I can see the error.. I thought I'd try to run OwinHost.exe manually...
I know how to cd to my web project's bin folder and then call out to the appropriate packages subdir to OwinHost.exe to make it start listening for web requests. But, it listens on port :5000 and I want to change this.
Ugh.. just figured it out... the -u switch..
..\..\packages\OwinHost.3.1.0\tools\OwinHost.exe -u https://localhost:443/

localhost refused to connect Error in visual studio

I have copied my solution file from another system and tried to run it on my machine:
For this, I have gone to the project folder and deleted the previous solution file and copied the new one.
Now, it started giving me error. connection refused etc. So, I got one solution from here: How to solve ERR_CONNECTION_REFUSED when trying to connect to localhost running IISExpress - Error 502 (Cannot debug from Visual Studio)?
According to it, I changed the port number from 1049 to 1052. It loaded and one of the pages gets loaded.
But when I entered the desired login credentials then it redirected to the older port again, like this:
http://localhost:1049/Home/SearchFlight
and the error is:
This site can’t be reached
localhost refused to connect.
Search Google for localhost 1049 Home Search Flight
ERR_CONNECTION_REFUSED
Now, I don't know what to do from here. I have changed the port number to 1052 but still its pointing to 1049. What should i do now?
I had a similar issue. Try this and it should work
Go to your project folder and open the .vs folder (keep your check hidden item-box checked as this folder may be hidden sometimes)
In the .vs folder open the config folder
See that applicationhost.config file there? Delete that thing. (Do not worry it will regenerate automatically once you recompile the project.)
Usually on local machine we are getting errors like This site can't be reached localhost refused to connect because we have self signed certificate configuration broken for local IIS Express. Sometimes it happens when you change URLs in launchSettings.json or never configured self signed certificates on this machine at all.
To fix self-signed certificate on the local machine you need to: 
Delete .vs folder (requires to close Visual Studio 2017)
Run these commands in cmd As Administrator:
cd "C:\Program Files (x86)\IIS Express"
IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:12345/ -UseSelfSigned
Make sure you run VS2017 As Administrator and check if the issue addressed
Note: https://localhost:12345/ is what is in your launchSettings.json for HTTPS
Changing port number has resolved the issue
Just Delete the (obj)Object folder in project folder then Run the application then It will work fine.
Steps:
Right Click on the project folder then select "Open folder in file Explorer".
Then Find the Obj folder and Delete that.
Run the Application.
Unfortunately, none of these answers worked for me. This answer finally did for Chrome only. Unfortunately, you have to do it each time:
Open this in your browser: chrome://net-internals/#hsts
Go to Delete domain security policies
Enter "localhost"
Restart browser
Google Chrome redirecting localhost to https
I had the same problem. Deleting .vs folder (including all contents, folder might be hidden) worked for me.
I solved a similar problem by listing bound IP addresses in a cmd window running as admin:
netsh http show iplisten
Then, one by one, blowing them all away:
netsh http delete iplisten ipaddress=127.0.0.200
netsh http delete iplisten ipaddress=127.0.0.2
...
In my case, I need to update "publishAllPorts" = false in .Net 5 MVC project's launchSettings.json.
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": false
}
I ran my Visual Studio as "Run as administrator" and this solved my problem.
Go to control panel > Programs and feature > IISExpress > Repair
If found it was because I had been messing about with netsh http add commands to get IIS Express visible remotely.
The symptoms were:
the site would fail to connect in a browser
the site would fail to start (right click IIS Express in the Taskbar and it was missing)
if I ran Visual Studio as admin it would start in IIS Express and be visible in the browser
The solution was to list all bound sites:
netsh http show urlacl
then delete the one I had recently added:
netsh http delete urlacl url=http://*:54321/
In addition I had removed localhost from the hidden solution folder file .vs\config\application.config for the site:
<bindings>
<binding protocol="http" bindingInformation="*:54321:" />
</bindings>
so had to put that back:
<bindings>
<binding protocol="http" bindingInformation="*:54321:localhost" />
</bindings>
This happened to me in VS2017 v 15.6.7 using .net core 2.0.
When the project first launched it created an SSL Cert for localhost and started fine. When I disabled SSL I kept getting this issue.
Apparently when you disable SSL the port numbers are changed and not all of the port numbers get changed to the new port. Make sure port numbers on Debug are all the same number.
I was having this issue and solved it by closing all open instances of Visual Studio.
Open cmd as administrator and run this command:
netsh http delete iplisten ipaddress=xxx.xxx.x.xxx
ipaddress is your private ip.
This worked for me.
I faced this annoying problem all the time in my Visual Studio MVC application especially when you start your work in the morning. Many solutions in this thread works sometimes; but there were many times none of this solves my issue.
At last I figured out only a combination of these steps works for me. Hope this helps somebody.
Close VS.
Delete .vs folder under your solution. Don't worry, it will be automatically created when you open the solution again.
Delete bin and obj folders.
Delete your cookies from the browser that you use to debug the application.
Delete the *.csproj.user file located in the project folder.
Open your startup project file (*.csproj) in Notepad++ or your favorite editor. Go towards the end of the file and delete below 3 lines that contains the local development port info. Don't worry it will be recreated on running the solution again.
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:60573/</IISUrl>
Open your solution again, clean, build and run it. You should be good to go. If this don't work, restart your machine after step 6.
For this to work for me, all I had to do was recreate the virtual directory. I had re-installed Windows and then pulled the project back out of Git. To do this, right-click on the solution project and choose Properties, then go to the Web tab and click the Create Virtual Directory beside the Project Url.
I hope this helps someone else too!
Bud
Project properties> Web > Create Virtual Directory worked for me
Right Click on Project >> Properties >>
Select Web Tab >> Under server Select "Use Visual development server"
so indirectly it will uncheck "Local IIS Server"
Hope so it may resolve this issue.
Change the port number and remove script debugging (if enabled) to resolve in localhost.
I've tried everything but nothing worked, but this did.
If you can debug on local IIS instead of Express, change the configurations as shown in the image below. Do not forget to click on "Create virtual directory"
rebooting the machine was the only thing that worked for me
I recently ran into this exact problem and tried most of the suggestions but it turns out my problem was something different.
Our application has a section that redirects you to HTTPS if you are on HTTP (yes, I know there are better ways but this is legacy). In addition, there is special handling of localhost when you are in dev mode which redirected you back to HTTP, though I don't know why.
I have a new requirement that requires testing in HTTPS.
On a normal web page, changing http:// to https:// and calling Redirect would work fine but in IISExpress you are using custom ports. So for example, if you are on https://localhost:44300 you can't just switch to http://localhost:44300 b/c that port only serves https, not http.
So, if you are having this problem and you've cleared the config files and it didn't help, check your code for redirects. you might have something using a hardcoded or partially hardcoded url or a url from a config file that you haven't updated to https.
Update:
I also suggest clearing all .suo and .user files and someone else suggested clearing the obj/ folder. I suggest doing this with VS closed and then restarting. I had a lot of trouble with values for ports being cached when i tried to setup https:// and change ports. I also suggest trying this suggestion to check that the SSL port is within the correct range, though I don't know if that is still a requirement https://stackoverflow.com/a/24957146
In my case, Visual Studio 2017 > Tools > Options
In Debugging menu in the side list find Edit and Continue
Uncheck the Enable Edit and Continue check box
This resolves my problem.
Same problem here but I think mine was due to installing the latest version of Visual Studio and having both 2015 and 2019 versions running the solution. I deleted the whole .vs folder and restarted Visual Studio and it worked.
I think the issue is that there are multiple configurations for each version of Visual Studio in the .vs folder and it seems to screw it up.
Sometimes https and http ports can be same because if two tags are given same ports
IISExpressSSLPort and DevelopmentServerPort
Make sure these two ports have different ports
then in IISUrl use your default port either HTTP or HTTPS
https://localhost:44365
For HTTPS Use IISExpressSSLPort
For HTTP Use DevelopmentServerPort
Then you may delete hidden .vs folder in solution folder
Try deleting cookies for your localhost
My problem turned out to be a property which called itself:
Once I fixed this, the misleading connection error message disappeared.
None of these solutions worked for me. I'm not 100%, but I think my issue might have been with running the same project on the same port from multiple branches. That used to be an issue for me on Local IIS --- I'm not sure if that's also an issue on IIS Express. What worked for me was following this solution:
https://stackoverflow.com/a/27033934/2133723
Which says to go to:
File -> Open -> Web Site...
and remove the relevant projects. After this, I was able to run the project without changing the port.
Prior to doing this, I had followed the other solutions posted on this question (which didn't help me), such as deleting the .vs folder, so I'm not sure if that would be a necessary step prior to removing the website from File -> Open -> Web Site....
Like Donny V. this happened to me in VS2017 using .net core 2.0.
When the project first launched, VS displayed a dialog, offering to create an SSL Cert for localhost - but I didn't want to use SSL, so I stopped running and went into Project Properties and disabled SSL (a checkbox that can be cleared). After doing that I kept getting the issue described.
After trying many things what actually resolved the issue for me was editing the launchSettings.json file located under [ProjectName]/Properties - it's accessible from Solution Explorer.
When the editing was complete, the contents looked like this (where 12345 is a Port Number, and where MyNETCoreApp is the name of the project).
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:12345/"
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "http://localhost:12345/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MyNETCoreApp": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:12345/"
}
}
}
The edits I made were:
Updated the Port Numbers so they were all the same number
Removed a key:value of ssl:0 in one spot
Updated all https:// instances to be http://
I had to add https bindings in my local IIS

"Project file changed" issue in PhpStorm during working remotely

I have CIFS mounted folder on my PC, where houses a PHP project.
And very often dialog box appears with the message:
Project file /path/to/mounted/directory/.idea/workspace.xml" has been
changed externally. It is recommended to reload project for changes to
take effect.
I don't make any changes in this file, but PhpStorm thinks sometimes that file was changed and shows this dialog.
This directory mounts on system startup, and this is the corresponding fstab string:
//host/path /media/server cifs _netdev,credentials=/home/user/.smbcredentials,iocharset=utf8,sec=ntlm,uid=1000,gid=1000 0 0
This mount settings I've made today. Before that the directory was mounted through sshfs and all was OK without this annoying dialog box.
How can I resolve this problem?
I've found a current solution, I hope that this can help everyone that is encountering this issue.
**Go** to Settings (File->Settings (Ctrl+Alt+S) )
and reach Appearance & Behavior-> System Settings
uncheck all 4 options of Synchronization.
This is how I managed to fix this problem, now I don't have to
reverse commit,
No dialog box that the project has been modified externally and no workspace.xml popping up in SourceTree.

How to run Grails Wrapper (grailsw) behind a proxy?

I tried to run grailsw, but the wrapper cannot connect to download grails-2.2.1-download.zip (creates a 0 byte file instead).
I need to use a proxy server to connect to the internet, where do I configure proxy settings for the Grails Wrapper?
After running grails wrapper, your project directory has a new subdirectory called wrapper, with a file grails-wrapper.properties. You can configure your proxy settings in there, with the following properties:
systemProp.http.proxyHost=
systemProp.http.proxyPort=
systemProp.http.proxyUser=
systemProp.http.proxyPassword=
systemProp.http.nonProxyHosts=
I solved this problem for myself.
It is a two step process
1.a) Back up your JRE_HOME\lib\security folder. This is essential because the below steps might corrupt cacerts file under jre.
1.b) You need to install the ssl public key of Github.com to your local file system. To do that you have to use the InstallCert.java program( Link to InstallCert.java )
It is supposed to be run as java InstallCert github.com
and when it asks to enter cert number you need to enter 1
It will create a file with name "jssecacerts" in the current directory
1.c) But this program will not work because it does not know about how to authenticate with proxy. For this you need the code from SSLSocketClientWithTunneling page
Use the above two and create a program that tunnels through the proxy retrieves the ssl key and writes a file called jssecerts
2) Update your grails.bat with addtional options. Add these options to the %JAVA_EXE% command line. Paste them after %DEFAULT_JVM_OPTS%
-Dhttp.proxyHost=YourproxyURL -Dhttp.proxyPort=YourproxyPort -Dhttps.proxyHost=YourproxyURL -Dhttps.proxyPort=YourproxyPort -Dhttp.proxyUser=YourProxyUserID -Dhttp.proxyPassword=YourProxyPassword -Dhttps.proxyUser=YourProxyUserID -Dhttps.proxyPassword=YourProxyPassword -Djavax.net.ssl.trustStore=path-to-your-jssecacerts-created-in-step-1

rename wamp services

Is there a way to rename the services that are installed with wamp? I tried changing the name of all "wampapache" in wampmanager.ini and wampmanager.conf. That changed the name of the service installed, but then wamp's menus did not recognize the renamed service.
I give a step by step below. In short, wampmanager.ini does not control the configuration. It is generated by wamp using wampmanager.tpl. There are also a few scripts that should be changed.
For a complete answer, I also list how to change the port numbers.
run through installer - launch
remove services
exit wampmanager
open wamp/scripts/refresh.php
change all wampapache
change all wampmysqld
open wampmanager.conf
change all wampapache
change all wampmysqld
open wampmanager.tpl
change all wampapache
change all wampmysqld
open uninstall_services.bat
change all wampapache
change all wampmysqld
open bin/apache/apache/wampmanager.conf
change all wampapache
open bin/apache/apache/conf/httpd.conf
change 80 to <port>
open wampmanager.tpl
change localhost to localhost:<port>
open bin/mysql/mysql<version>/wampmanager.conf
change all wampmysqld
open bin/mysql/mysql<version>/my.ini
change 3306 to <port>
start wampserver

Resources