Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

asp.net core - Publish API in IIS

I want to put my API on the IIS, but the webpage has a long load and in the end it does not find the page! I do not know where my problem is. If anyone helps me, I will thank him.

The steps of Carmen are as follows:

Step 1: I Right click on the main project and I select its Publish and then I publish it in a folder. step1 step2

Step 2: In ISS, right-click on the sites and I select Add Website.

step3

Step 3: in the window Add a website ; I fill in the fields of site name, application pool, physical path, IP address, port.

step4

Step 4: Finally, I click on the browse, but it does not work.

I Try the other way, which a gives a message:

Step 1: Right click on the project then click on Property.

Step 2: In the launch section, click on the IIS. debug

But when I run the project, the message comes: message

Tell me if there is another way.

question from:https://stackoverflow.com/questions/65643319/publish-api-in-iis

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found the solution:

first step:

Looks like it's failing trying to open a connection to SQL Server.

You need to add a login to SQL Server for IIS 'IIS APPPOOLDefaultAppPool' and grant permissions to the database.

In SSMS, under the server, expand Security, then right click Logins and select "New Login...".

In the New Login dialog, enter the app pool as the login name and click "OK".

step2: Run this sql script

IF NOT EXISTS (SELECT name FROM sys.server_principals WHERE name = 'IIS APPPOOLDefaultAppPool')
BEGIN
    CREATE LOGIN [IIS APPPOOLDefaultAppPool] 
      FROM WINDOWS WITH DEFAULT_DATABASE=[master], 
      DEFAULT_LANGUAGE=[us_english]
END
GO
CREATE USER [WebDatabaseUser] 
  FOR LOGIN [IIS APPPOOLDefaultAppPool]
GO
EXEC sp_addrolemember 'db_owner', 'WebDatabaseUser'
GO

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...