Skip to content

Added Note to add .UseIISIntegration()#2878

Closed
jolivr wants to merge 7 commits into
dotnet:masterfrom
jolivr:patch-1
Closed

Added Note to add .UseIISIntegration()#2878
jolivr wants to merge 7 commits into
dotnet:masterfrom
jolivr:patch-1

Conversation

@jolivr
Copy link
Copy Markdown

@jolivr jolivr commented Mar 3, 2017

The WebAPI project template did not include .UseIISIntegration() in my Program.cs Main(). However, Visual Studio was still defaulted to IIS Express. This would cause the app to display a blank browser that never loaded content.

The WebAPI project template did not include .UseIISIntegration() in my Program.cs Main(). However, Visual Studio was still defaulted to IIS Express. This would cause the app to display a blank browser that never loaded content.
@dnfclas
Copy link
Copy Markdown

dnfclas commented Mar 3, 2017

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

Copy link
Copy Markdown
Collaborator

@guardrex guardrex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for providing this. A few minor nits, and you should use a snippet and a highlight with the sample code. Let me know if you have any questions.

Comment thread aspnetcore/tutorials/first-web-api.md Outdated
In Visual Studio, press CTRL+F5 to launch the app. Visual Studio launches a browser and navigates to `http://localhost:port/api/values`, where *port* is a randomly chosen port number. If you're using Chrome, Edge or Firefox, the data will be displayed. If you're using IE, IE will prompt to you open or save the *values.json* file. Navigate to the `Todo` controller we just created `http://localhost:port/api/todo`.

> [!NOTE]
> If you are attempting to use IIS Express (default) and the application does not display in your browser, check to make sure that your Main function in Program.cs includes ```csharp .UseIISIntegration()```
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits:

  • Use contractions ("you're" over "you are" and "doesn't" over "does not")
  • Personally, I'd go with "confirm" over "check to make sure" just because it conveys the same info faster. 🏃
  • Say "Main method" and use a single backtick on each side of "Main" ... use `Main`
  • Filenames should be in italics, so put one asterisk (*) around "Program.cs" ... use *Program.cs*
  • Inline code should have a single backtick and drop the "csharp" ... so it will just be `.UseIISIntegration()`
  • Since this points directly at a code sample, place a colon at the end of the line.

Comment thread aspnetcore/tutorials/first-web-api.md Outdated
> [!NOTE]
> If you are attempting to use IIS Express (default) and the application does not display in your browser, check to make sure that your Main function in Program.cs includes ```csharp .UseIISIntegration()```

[!code-csharp[Main](first-web-api/sample/src/TodoApi/Program.cs)]
Copy link
Copy Markdown
Collaborator

@guardrex guardrex Mar 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's close this down just to the Main method and highlight the row, so modify the Program.cs file in the sample and place a "snippet1" around the Main method. Look at the following example from the ToDoController. The snippets are created using #region snippet_name and #endregion: https://github.com/aspnet/Docs/blob/master/aspnetcore/tutorials/first-web-api/sample/src/TodoApi/Controllers/TodoController.cs#L17-L34

... then refer to the snippet and highlight the line like I show below. I'm using "snippet1" here, but you can name it something more explicit if you like. The highlight counting starts with the first line in the snippet, so the .UseIISIntegration() line should be line 6.

Final note: To get the snippet into the NOTE, I think you'll need to get a > in front of it. In the contribution guidelines there's a section on how to build the docs locally in DocFX so that you can see the rendered snippet in the browser to confirm that things like this are correct. https://github.com/aspnet/Docs/blob/master/CONTRIBUTING.md#test-your-changes-with-docfx

>  [!code-csharp[Main](first-web-api/sample/src/TodoApi/Program.cs?name=snippet1&highlight=6)]

jolivr added 3 commits March 3, 2017 12:33
Use contractions ("you're" over "you are" and "doesn't" over "does not")
Personally, I'd go with "confirm" over "check to make sure" just because it conveys the same info faster. 🏃
Say "Main method" and use a single backtick on each side of "Main" ... use `Main`
Filenames should be in italics, so put one asterisk (*) around "Program.cs" ... use *Program.cs*
Inline code should have a single backtick and drop the "csharp" ... so it will just be `.UseIISIntegration()`
Since this points directly at a code sample, place a colon at the end of the line.
snippet_program_main
Using function specific snipped
Add Highlight to specific line
@guardrex
Copy link
Copy Markdown
Collaborator

guardrex commented Mar 3, 2017

@jolivr Thanks ... excellent work!

@Rick-Anderson LGTM if placing the code inside the NOTE with > is the right way to go ... I don't think I've had the pleasure of trying that myself ... yet! 😀

@Rick-Anderson
Copy link
Copy Markdown
Contributor

@jolivr thanks for your consideration. There are endless reasons why the app might not behave as expected and we can't provide a note for each. This is our most popular tutorial and I've never seen this complaint before. If you follow the instructions you'd have to remove that call.

@Rick-Anderson
Copy link
Copy Markdown
Contributor

@jolivr a good place to add this note is in a LiveFyre comment where you added your comment. If you think more than a few people will hit it you could even put it on SO

@jolivr
Copy link
Copy Markdown
Author

jolivr commented Mar 3, 2017

@Rick-Anderson I was using VS 2017 and as it turns out, if you click "Add Docker Support" which I had done inadvertently, it does not add .UseIISIntegration().

@Rick-Anderson Rick-Anderson reopened this Mar 3, 2017
@dnfclas
Copy link
Copy Markdown

dnfclas commented Mar 3, 2017

@jolivr,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla2.dotnetfoundation.org.

It will cover your contributions to all Microsoft-managed open source projects.
Thanks,
.NET Foundation Pull Request Bot

@dnfclas
Copy link
Copy Markdown

dnfclas commented Mar 3, 2017

@jolivr, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, .NET Foundation Pull Request Bot

@Rick-Anderson
Copy link
Copy Markdown
Contributor

Lets keep the note as short as possible. I don't think many folks will hit this. To repro your problem you need to:

  1. Have Docker install.
  2. Check Enable Docker Support

I wouldn't expect IIS Express to work with a docker project.
If you didn't install docker and checked Enable Docker Support, you'd get a different error.

@spboyer @tdykstra please review.

@Rick-Anderson
Copy link
Copy Markdown
Contributor

@jolivr We need to update this for VS2017. I added warning up front.

@Rick-Anderson
Copy link
Copy Markdown
Contributor

@jolivr Thanks for pointing this out. I'm going to update this document with new screen shots and I'll add a docker warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants