Occasionally I have a problem when I attempt to update a web reference in Visual Studio 2008 (this also happened in VS2005). It has happened in several different solutions.
When I have a solution with a (.NET 2.0) web service and a project that references the web service I get "There was an error downloading 'http://localhost:3890/MyWebService.asmx' Unable to connect to the remote server.". Obviously, the port number in the example is an example only, it could be any port number.
The web reference is set to 'Dynamic URL' and the web service is using the ASP.NET Development Server web server rather than IIS. When the error occurs the icon for the service never shows up in the system tray.
I have found two workarounds. The more drastic workaround is to delete the web reference and recreate it. This has worked for me everytime, but has caused some confusion for Subversion and AnkhSVN.
Recently it occurred to me to set the web service as the startup project, start it, and mouse over the ASP.NET Development Server icon on the system tray to find out the port number that it has chosen. Then, edit the port number in the WebReferenceUrl property of the web reference. After doing this I can update the web reference.
While this works I feel that there must be a better way. It seems that VS and Cassini should be able to resolve this without manual intervention. Am I missing something, or is this another case of Microsoft getting the difficult things right and the simple basics wrong?
I have attempted to search an answer for this issue and have found several threads describing the problem. But, no one has identified a real solution.
Right-click the service in Solution Explorer, and choose "View in Browser". That will cause the service to start, and you'll be able to use "Add Web Reference".
You can force the port of the test web site in visual studio.
Open the properties window in visual studio it with "F4" or via the toolbar - "View" -> "Properties Window".
Left click on your web site in the "Solution Explorer" window. Notice the drop down list for the "Use dynamic ports" setting. If you set this to "False", you'll then be able to specify a fixed port in the "Port number" field.
Set this to your desired port value.
Launch your web site. You'll see the port used matches the value you specified.
Go to project Properties-> Settings -> [Update the Service Url]
It Works.
Check appconfig file and update the port number accordingly
Related
The JetBrains Rider I'm using is the latest version, 2019.1.2 (free 30-day trial), from the official website. It's not a broken version.
I have a solution which contains an ASP.NET web API csproj. The solution was working properly in IIS, or VS + IISExpress.
Like VS, Rider also creates some configuration files in the folder .idea. In it, I can find the applicationhost.config file for IISExpress.
The problem is that IISExpress can never start and shows me an error once I start debugging in console:
**Failed to initialize site bindings**
Error initializing ULATQ. hr = 80070005
Terminating W3_SERVER object
InitComplete event signalled
Process Model Shutdown called
Waiting for all LISTENER_CHANNELS to stop
Unable to start iisexpress.
I checked the applicationhost.config file. It's the same as the one generated by VS. It also has the line of bind info, and I'm sure the port is available:
<bindings>
<binding protocol="http" bindingInformation="*:8080:localhost" />
</bindings>
Questions: Can Rider really work properly with IISExpress? Any idea how to config it and what files should be changed?
I finally found that, in Windows 10, it seems to be a permission problem that prevented Rider from starting IISExpress properly.
Solution:
Make sure to run JetBrains Rider as admin (most important for me, then IISExpress could work!)
Open the solution, right click the web project that will run on IISExpress.
Select Properties and go to the Web section.
Check Generate applicationhost.config before running it for the first time.
The URL should be http://locahost:8080/ (8080 could be any port. Has not supported any IP yet.)
Check Anonymous authentication to allow viewing and debugging the page.
Uncheck Generate applicationhost.config after running for the first time.
Make sure Rider is still working with IISExpress without any changes in both Properties and applicationhost.config.
Only if Rider is run as admin and the settings are correct in Properties would IISExpress work properly. Otherwise, it won't start or it merely returns HTTP 5XX/4XX.
Thank you #David Smith I found Generate applicationhost.config in edit Configuration iis here
Then find this option is here
I have recently had to reinstall my development machine so I'm unsure how I did this before.
A solution which I have currently has 3 projects that are needed for startup for debugging, this works fine, when I run the solution I get 3 pages open up in the browser which makes logical sense, however on my previous installation of my machine I only had one page open up, the API and MVC projects didn't show in the browser, but they were running so the entire application worked.
Is there a way to suppress the unneeded pages from opening up in the browser?
I found the option after a while, it was in the project properties, not the solution properties!
Here are the details if anyone is interested:
Right-click on the Project
Choose Properties
Go to the Web tab
In the Start Action section select the 'Don't open a page.
Wait for a request from an external application.' option.
I wanted to work offline because the TFS server is not currently available. Under the 'Advanced' button (seen in picture below) for one of the Working Folders within my workspace, I selected 'local' (instead of 'server') for the location. I thought this would allow me to work offline; however, after reading up on working offline, I realize this was not the correct action.
Now, the server is down and I cannot connect to the Source Control Explorer (see figure 2) to tell VS to work offline. Therefore, VS will randomly (maybe after certain interaction i attempt with VS) try to reconnect to the server. Additionally, there is no 'File | Source Control | go-offline' option.
QUESTION: is there anyway to tell TFS to stop trying to reconnect to the server (because server is down) after the server is already down (but not delete pending changes for the workspace).
Edit: using VS 2013
I've a problem with loading Web Application project in VS2013. This project depends on IIS Express, but I wouldn't install IIS Express because I already installed IIS.
What I can edit in .csproj file to load this project? I've tried to set to false, but it's wouldn't help me to solve problem.
Thank you for advice.
Upd.1: Also, I cannot create new web projects - VS tell me same things.
Happened to me too. My workaround:
Right-click the (failed-to-load) project => edit web.csproj
Find the line <UseIISExpress>true</UseIISExpress>, and change it to false.
Save, close, reload project.
Result - different error:
The Web Application Project web is configured to use IIS. To access local IIS Web sites, you must run Visual Studio in the context of an administrator account. In addition, you must install the following IIS components:
ASP.NET
So:
Edit again, change <UseIIS>True</UseIIS> to false
Save, close, reload project.
Result - Great Success!
Try to delete user config file "ProjectName.csproj.user" then reload project.
VS 2012 can't load project which uses IIS with custom binding host - thinks it's using IIS Express
It happened to me today. Changing "UseIIS" to false allowed to load project, but not use IIS. After some tests I've found the cause of the problem:
On previous CheckIn to VSS somehow the UAC (user account control) was switched on. So actually there were two alternatives: (i) Always use "Run as administrator" ; (ii) switch UAC off.
I prefer (ii).
I had a custom host file setup up with foo.localhost -> localhost bound on both ports for HTTP/HTTPS
checking on something i removed the host header for the binding on port 80.
once reloading solution is when everything started crashing.
found a really old post that reminded me that i removed that host name from the binding.
adding foo.localhost header back to the binding and all my projects started reloading.
If nothing works, try removing following two lines from .csproj file. (always worked for me)
<ProjectGuid>{3AA499DF-4A65-43B7-8965-D08A4C811834}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
Normally, in webforms , when you have to deploy the application , we publish from the Visual Studio and put the published folder only on the server (IIS). But, in MVC web applications , how is it done.
Does it follow the same way (published folder only on server ) or some other method.
I have tried the following methods but not got any result .
Web Deployment Package - After going through this tutorial -> http://pluralsight.com/training/players/PSODPlayer?author=scott-allen&name=mvc3-building-deploy&mode=live&clip=0&course=aspdotnet-mvc3-intro
under the Web Deployment Packages tutorial ,i found how to create a web deployment package which can be imported in the IIS Management Tool. Then I found out this link to help me with the same ->
http://www.iis.net/learn/publish/using-web-deploy/building-a-web-deploy-package-from-visual-studio-2010
. But after following all the steps I got this error ->
(See Screenshot)
What is/are the missing steps in this method?
2. Add roles - Windows Server 2012 - turn certain features of ASP.NET 3.5 and ASP.NET 4.5 on.
I followed this tutorial for the above step ->
http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45
As per the tutorial , I should for deploying a MVC 3.0 application , turn on the ASP.NET 3.5 and ASP.NET 4.5 features under the "Application Development" Tab . After this, to deploy the application ,i should under the "Advanced Settings" pop up choose .net V2.0 as the Application Pool ( See ScreenShot)
But even after following the tutorial i get the same error "Server error in Application ...."
3. Publish under the "File System" Method.
We right-click the project and select "Publish" and a Dialog box pops up showing the various options for deployment. In this we select - " File System" ( See Screenshot)
We published the project , but got the same error once again.
Problems / Questions ->
1. What is the correct full proof way of deploying a MVC 3.0 application on IIS 8 . ?
2. Do we need to put the whole solution on the server and run from there or otherwise
3. Are we missing some step or some command in the above three methods
4. Our requirement is to essentially find a way to put only the published folder on the server and run , but is that how it really works in MVC ( like web forms ) ?
5. File System approach ( point 3 above ) is something which is done commonly for Webforms , is it advisable to do the same in MVC as well .
6. The Deployment is working on localhost , but when tried by creating a Virtual Directory , it is again not working .
Working environment is Visual Studio 2012 - Web Server Windows Server 2012- IIS 8
Need help to solve the confusion.
Regards,
Mangesh
I have found a complete solution to Deploying an MVC 3.0 Application using IIS8 on Windows Server 2012. Here are the Steps:
Start your Visual Studio and select the "Run as Administrator" Option while running the IDE.
Change your Web.config to add the following line of code .
<globalization culture="en-US"/>
This ensures that even if your Target server has some different Settings, you enforce your own settings by mentioning this line of code. Otherwise , you might get problems such as
-- Submitting a form which has a Date Field , you might not be able to submit as the Date will be set to
01/01/01 :00:00:00:00
Build - Follow three sure-shot steps .
a. Clean Solution
b. Build Solution
c. Re-build Solution
Check-in your solution completely if you are working on a shared Environment . Right click on the Project Solution and select the Publish Option. ( ScreenShot)
This opens up a Dialog Box such as this.(Screenshot 2) . This will show you possible options for deployment and some other settings.
On this screen you do not have to do much and pretty much it automatically sets the default settings for the current publish profile.
Next Screenshot :
Click on the next tab and you will see a bunch of options such as the following:
The first option asks you for the publish method . They are four options in this :
a. Web-deploy
b. Web -deploy package
c. File system
d. FTP
e. FPSE.
My Publish Method is "File System". I have also deployed applications using the Web- Dpeloy and the Web- Deploy Package, but for the sake of this article I will stick with File System.
The next parameter asks the Target Location where u want the Published folder to be. This can be a local Location on your Hard-Drive or a Remote location on the server. I have chosen a remote location on the server , there i have created a Publish folder and it is here where all my files will go after Publish.
The Destination URL is optional . I have left it Empty.
Lets move on the next screen shot.
The Settings tab gives u the following options :
Configuration: There are two options in this drop Down - Debug and Release. Choose Release option.
Make sure u tick the "Delete all existing files prior to publish" Option. This will clear all the existing files prior to every time u publish your project.
This method of publishing does not support Database Publishing . Hence , if you are creating one in your project , then do not use this for publishing. In my case, I have used an external Database for binding to my Model Classes , hence this method will work.
In the next Screen Shot : You preview your settings before you publish the project.
It will show the Target folder where the published Files/Folder will reside and the Project it is going to publish and again the warning stating that Databases will not be published .
Click on publish .
Check your Output Window as it will show Line by line the steps it will take for publishing.
In the end , it will display the message of Successfully Published Project .
Next step: Go to your location where your published files will be kept.
ScreenShot:
You should get something like this :
This is your published Folder and the Files . Lets now tweek the IIS to run web-site.
Go to IIS8 and right click the on this option as per the screenshot. ( This shot may vary from system to system ).
Click on Add Web Site which opens up another Dialog such as below .
Enter Your Site Name and then Click on the "Select" Button on the right -hand side of the page, which will open up another Pop-Up as below.
Select your appropriate Framework from this Drop Down. Since mine is an MVC 3.0 Project , i went for ASP.NET 4.0 Settings. (Please try these options to know which settings suit you.)
Moving on, Enter/ browse to your physical Path where your solution is kept. In My case, the screenshot I showed where all my published files went . ( Sometimes to avoid conflict of folders , create a separate folder and enter that as your physical location and just copy the files from the folder where you published it to the new folder )
Leave rest of the entries as it is. If some application is already running on the Default -80 port , then give a new port . Click on OK.
Restart your IIS . Go to the browser and type out the URL .
And thats it !!
Your MVC 3.0 Web Application has been successfully Deployed.
Thanks,
Mangesh
(PS -Please leave your comments for anything which is not clear and if you find it useful don forget to +1 :))