Deploying the ASP.net MVC Project on IIS

Source: Internet
Author: User
Tags static class

Foreword: recently will often modify the content of some Web site front-end, in order to facilitate communication with the UI and products, you need to modify the page in a timely manner to the test machine or local IIS. In order to familiarize yourself with some of the IIS applications, the project was published on local IIS, which encountered some problems that were now resolved and then recorded and left for later use.

Flowchart:

How to enable and configure IIS here is not much to say, the main want to record is in the trial run in the process of some of the problems encountered.

several key points for configuring IIS:
1.URL rewrite module, which used to be ISAPI filter function, later seems to be revised, are modular design. (URL rewrite download link)
The 2.asp.net MVC project has routing mechanisms, so there is no need to use the default document features and directory browsing capabilities in IIS.
3. Remember to check the. NET Framework version of the application pool, configured as a v4.0 version.
4. Authentication is generally not used, and IIS defaults to anonymous authentication.

three major problems
1. The test run does not normally access the Web site, the error is as follows:
Error summary
HTTP Error 403.14-forbidden
The WEB server is configured to not list the contents of this directory.

The main reason for the local project Web.config file error, missing line of code, the completion of the code is as follows:

<system.webServer> 
<modules runallmanagedmodulesforallrequests= "true"/> 

Attached reference Links: Point me

2. After this problem is resolved, run the newspaper again CS0016 failed to write an output file error, the problem here is that the corresponding group or user of IIS does not have access to the local folder C:\Windows\TEMP, and enters the Security tab of the Properties window of the Temp folder to modify.

3. From the project itself, the coverage is wide. I was confronted with two main questions:
3.1来 from the logic of the JS file, the use of the Documen.domain attribute, you can use this property to obtain the current URL of the server name or IP address, in order to determine whether the current user to run the site is legitimate.

3.2来 the settings for each URL entry in the Web site. Here is a background: When debugging online, the server name in the URL is generally "localhost: port number", while online will be replaced by the corresponding domain name, in order to modify the convenience, there are the following settings:

Web.config file:

<appSettings>
<!--domain name-->
    <add key= "domain" value= "http://localhost:7676"/> <add
    key= "Host" value= "localhost"/>
</appSettings>

In a static class:

public static partial class Webuihelper
{public
    static readonly string dominurl = configurationmanager.appsettings["Domain"];
}

In a page:

@{
    var hosturl = webuihelper.dominurl;
}
<a href= "@ (hosturl)/***/" >

Remember to modify the Web.config file when you publish it to IIS.

Conclusion
1. The whole stack of engineers is very powerful. Whole Stack engineer = basic knowledge of deep + Perfect machine model + computer network + all kinds of back and forth language.
2. Programmers who do not want to know the logic of the product cannot be a qualified engineer.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.