locked
ASP .NET Project redirecting RRS feed

  • Question

  • User1266884534 posted

    I have inherited some code that is supposed to run from Visual Studio. This is a webforms project having a Data Layer, a Service Layer and a Web Layer all in the same solution.

    My local site starts with the url: http://localhost:63527/ in the address bar.
    Then it changes to https://localhost:44302/ and an error message.

    This site can’t be reached

    The connection was reset.

    Try:

    ERR_CONNECTION_RESET
    Thursday, January 23, 2020 8:42 PM

All replies

  • User475983607 posted

    I have inherited some code that is supposed to run from Visual Studio. This is a webforms project having a Data Layer, a Service Layer and a Web Layer all in the same solution.

    My local site starts with the url: http://localhost:63527/ in the address bar.
    Then it changes to https://localhost:44302/ and an error message.

    Those are two different sites; 44302 and 63527.   If this is one site then you could have a hard coded bug.  If there are two sites then 44302 is not running.  

    Thursday, January 23, 2020 9:51 PM
  • User409696431 posted

    The site is redirecting to https.  In VS you can choose to have a project run over SSL, and it will use a local self-signed certificate and assign a second port number.  Since you inherited the code, this is probably not correctly set up in your local Visual Studio.

    Right-click the project in VS (not the solution, the webforms project) and select Properties Window.  You'll see SSL Enabled set to true or false.

    IF true, an SSL URL will show.   If one doesn't show, set SSL Enabled to True, and one will appear.

    Look in the projects's application.config file (in the .vs folder for the project) and find a section that looks like the following (with your own project's name and bindings):

                <site name="WebFormsSiteDb" id="2">
                    <application path="/" applicationPool="Clr4IntegratedAppPool">
                        <virtualDirectory path="/" physicalPath="C:\Users\kathl\source\repos\WebFormsSiteDb\WebFormsSiteDb" />
                    </application>
                    <bindings>
                        <binding protocol="http" bindingInformation="*:50988:localhost" />
                        <binding protocol="https" bindingInformation="*:44340:localhost" />
                    </bindings>
                </site>

    make sure the https binding matches the port you've set up.  See if that sorts things out.

    Of course you could also check and see where the redirection is occuring (the web.config, for example), and remove it, but if the project is supposed to run over https, and that is strongly encouraged now, it would be better to leave it.

    Friday, January 24, 2020 12:54 AM
  • User1535942433 posted

    Hi learning_to _code,

    Accroding to your description, I think you could try:

    1.Delete YourSolutionFolder\.vs\config\applicationhost.config file (note: .vs is a hidden folder)

    2.Open Visual Studio, right-click on web site > Properties > Debug tab > Web Server Settings > App URL - change port number.

    More details,you could refer to below articles:

    https://stackoverflow.com/a/38926529/5751404 

    https://stackoverflow.com/a/36801686/5751404 

    Best regards,

    Yijing Sun

    Friday, January 24, 2020 8:13 AM