MatthewL Posted June 11, 2024 Posted June 11, 2024 We have an intenal website that has been designed in visual studio, the SMTP host has been hard coded into it, so it should just be a case of updated and rebuilding the project but its not updating and still using the old host. Is there anything else I need to do when updating a project? I'm no coder and have inherited the issue with no documentation but worked out what needs changing but just cannot get it to work. Any suggestions?
mavhc Posted June 11, 2024 Posted June 11, 2024 Will need way more details, where's it hosted, how is it updated, where is it built?
Bedders Posted June 11, 2024 Posted June 11, 2024 We develop in Visual Studio and publish to an internal IIS server for intranet sites. Broadly speaking, the process may look something like: - Open the project in Visual Studio (ideally you have this via the Solutions file, ending .sln). - Edit the hardcoded SMTP server. I'd suggest moving this to a text file and reading from there. - Rebuild the project in Visual Studio. - Change the version from 'Debug' to 'Release'. - Publish the project in Visual Studio. Where to depends on what PC you're developing on, but I would suggest simply publish everything to a subdirectory of the solution/project folder. - BACKUP all of the current folder on your webserver. This means you can go back to a 'known good' version. - Copy the published folder (the entire thing and any subfolders) into the folder on your webserver. Even if dates haven't changed still do the entire folder. - Overwrite anything it asks to. You've already taken a backup so should be good to do so. If it can be broken by this, then it can be restored by copying the original files. - CTRL + F5 the website and see if it's updated. May take a couple of minutes. Happy to discuss more via PM and give you a demo via video call of how I do it!
MatthewL Posted June 11, 2024 Author Posted June 11, 2024 So its hosted on an internal IIS server, i just edited the file on the server in visual studio. I did the build bit but not publish maybe this is where have gone wrong. I have a snapshot of the server I can revert back to if I need to for this purpose and ease as I did break it the other day when looking. Will review in the morning @Bedders, thanks for your assistance so far, will let you know how I get on.
Bedders Posted June 11, 2024 Posted June 11, 2024 So its hosted on an internal IIS server, i just edited the file on the server in visual studio. I did the build bit but not publish maybe this is where have gone wrong. I have a snapshot of the server I can revert back to if I need to for this purpose and ease as I did break it the other day when looking. Will review in the morning @Bedders, thanks for your assistance so far, will let you know how I get on. Editing the file on the server works for older ASP pages but rarely for full .NET applications. As such you will most likely need to edit it in Visual Studio, build, and republish it - this way all of the related files are updated. Best of luck and let us know how you get on!
MatthewL Posted June 12, 2024 Author Posted June 12, 2024 So I followed these steps: 1. **Open Your Project in Visual Studio**: Make sure you have your Visual Studio project open. 2. **Make the Change**: Edit the `.aspx.vb` file to make the required change. 3. **Save the File**: Save the changes you made to the file (`Ctrl + S` or `File > Save`). 4. **Build the Project**: - **Rebuild the Entire Solution**: Go to `Build > Rebuild Solution` to rebuild the entire project. This will ensure that all changes are compiled and included. - Alternatively, you can select `Build > Build Solution` if you only want to compile the changes without cleaning the entire solution. 5. **Run the Project**: Once the project is successfully rebuilt, you can run it by pressing `F5` (Start Debugging) or `Ctrl + F5` (Start Without Debugging). This will start your web application, and the changes in the `.aspx.vb` file should now be reflected. Once this was done I then went to Build and then Publish but it then errors out on the IIS site. Any suggestions as I feel I am nearly there but no experience of Visual Studio I feel like I am missing something.
Bedders Posted June 12, 2024 Posted June 12, 2024 What is the error that you get on the IIS site? Note that if you've got default site security, the error message will only be viewable by browsing to the site locally on your web server itself. Did you Publish it directly to the web server, or did you publish it locally and copy the files?
MatthewL Posted June 12, 2024 Author Posted June 12, 2024 It was an IIS error about a file not been there, forgot to screenshot it. All was done on the web server itself, nothing copied all local. I just reverted changes and came back to the drawing board.
Bedders Posted June 12, 2024 Posted June 12, 2024 When you say "all was done on the web server itself" do you mean that you have Visual Studio installed on the IIS Web server? Or is it installed on a dekstop PC, and you changed the Publish target to the actual folder for the site on the IIS web server? If you are editing an aspx.vb file directly on the server then it won't work. The whole project needs to be rebuild and republished if you're editing any of the '.vb' files. You will probably be ok editing anything jsut ending in '.aspx' directly on the web server, but I'd still avoid it where possible so that your development version (with the solution and project) don't get out of sync with the live version on your web server.
MatthewL Posted June 12, 2024 Author Posted June 12, 2024 Visual Studio is installed on the IIS web server and changes where made and rebuilt/republished.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now