zoukankan      html  css  js  c++  java
  • ASP.NET CORE 基础配置、Linux发包

    一、asp.net core 使用IIS EXPRESS启动的配置【经测试,即使以下都配置正确,某些地方配置问题一样打不开,具体不清楚】
    1、
    打开了IIS Express的先关闭,否则配置了也无效
    网站上方右键-调试-启动新实例
    找到电脑托盘里的IIS Express右键-查看所有程序-点击网站-下方会出现配置文件地址-找到配置文件(一般会在根目录下的.vs文件夹里)-找到 <sites>标签
    <bindings>
       <binding protocol="http" bindingInformation="*:59310:localhost" />//这个站点是启动调试后自动生成的
       <binding protocol="http" bindingInformation="*:80:videoadmin.vsofo.com" />//这个是需要配置的,不配置的话启动只可以用上面那个地址
    </bindings>
    
    2、然后执行dos命令,一般设置为域名
    netsh http add urlacl url=http://video.vsofo.com:80/ user=everyone
    
    3、launchSettings.json文件里的commandName一定得是IISExpress,如下代码
     "profiles": {
        "IIS Express": {
          "commandName": "IISExpress",
          "launchBrowser": true,
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        }
    PS:1、若站点启动不了,可尝试删除根目录下的.vs文件夹,重新编译项目再启动即可
    2、
    删除dos命令: netsh http delete urlacl url=http://video.vsofo.com:80/


    二、IIS启动项目
    1、IIS配置完毕,应用池选择无托管模式

    2、如果用域名访问的需要修改host文件,假设本地IP是192.169.0.1(ping一下看下IP多少),域名随便写的,需要根据实际情况填写
    @echo off
    color 0A
    title 短信支付环境配置,HOST文件修改器
    @echo ########################################
    @echo "请注意你的杀毒软件提示,一定要允许"
    @echo ########################################
    if not exist C:Windowssystem32driversetchosts.bakhosts (goto bakhost) else (goto process);
    
    :process
    @echo 命令即将开启Hosts文件的修改权限。
    @attrib "%windir%System32Driversetchosts" -r -a -s -h
    @echo ------------------------------------------------------------------
    @echo Hosts文件修改权限已开启,开始修改Hosts文件,请按所需选择。
    @echo ------------------------------------------------------------------
    @cd.> %systemroot%system32driversetchosts
    @echo # Copyright (c) 1993-2009 Microsoft Corp.>>%systemroot%system32driversetchosts
    @echo #>>%systemroot%system32driversetchosts
    @echo # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.>>%systemroot%system32driversetchosts
    @echo #>>%systemroot%system32driversetchosts
    @echo # This file contains the mappings of IP addresses to host names. Each>>%systemroot%system32driversetchosts
    @echo # entry should be kept on an individual line. The IP address should>>%systemroot%system32driversetchosts
    @echo # be placed in the first column followed by the corresponding host name.>>%systemroot%system32driversetchosts
    @echo # The IP address and the host name should be separated by at least one>>%systemroot%system32driversetchosts
    @echo # space.>>%systemroot%system32driversetchosts
    @echo #>>%systemroot%system32driversetchosts
    @echo # Additionally, comments (such as these) may be inserted on individual>>%systemroot%system32driversetchosts
    @echo # lines or following the machine name denoted by a '#' symbol.>>%systemroot%system32driversetchosts
    @echo #>>%systemroot%system32driversetchosts
    @echo # For example:>>%systemroot%system32driversetchosts
    @echo #>>%systemroot%system32driversetchosts
    @echo #      102.54.94.97     rhino.acme.com          # source server>>%systemroot%system32driversetchosts
    @echo #       38.25.63.10     x.acme.com              # x client host>>%systemroot%system32driversetchosts
    @echo #>>%systemroot%system32driversetchosts
    @echo # localhost name resolution is handled within DNS itself.>>%systemroot%system32driversetchosts
    @echo #    127.0.0.1       localhost>>%systemroot%system32driversetchosts
    @echo #    ::1             localhost>>%systemroot%system32driversetchosts
    
    
    @echo 1、xxx的环境(输入1) 
    @echo.>>%systemroot%system32driversetchosts
    @echo ------------------------------------------------------------------
    SET /p string=请选择环境:
    IF "%string%"=="1" goto 1
    :1
    @echo ------------------------------------------------------------------
    @echo 选择了开发环境,所设URL将指向内网192.168.0.01。
     
    @echo 192.168.0.01 www.baidu.com>>%systemroot%system32driversetchosts
    goto end
    
    
    :4
    @echo ------------------------------------------------------------------
    @echo 选择了现网环境,系统将清空所有HOST文件设置。
    goto end
    
    :5
    @echo ------------------------------------------------------------------
    @echo 选择了还原HOST,系统将还原最初备份的HOST文件。
    @copy C:WindowsSystem32driversetchosts.bakhosts C:WindowsSystem32driversetchosts /y
    goto end
    
    
    :bakhost
    @echo 开始备份现有HOST文件。
    @xcopy C:Windowssystem32driversetchosts C:Windowssystem32driversetchosts.bak /d /c /i /y 
    @echo Hosts文件备份完毕。
    @echo ------------------------------------------------------------------
    goto process
    :end
    
     
    
    @pause>>nul
    @echo 请确认浏览器已关闭,并继续!
    @echo ##########
    @pause>>nul
    ipconfig /flushdns
    @echo ##########
    @echo 域名解析缓存已更新,按下任意键退出本程序!
    @echo ------------------------------------------------------------------
    @echo.
    pause
    EXIT
    View Code

    3、launchSettings.json 文件,注意applicationUrl配置的域名要与IIS一致

    "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iis": {
    "applicationUrl": "www.baidu.com",
    "sslPort": 0
    },
    "iisExpress": {
    "applicationUrl": "http://localhost:47784/",
    "sslPort": 0
    }
    }

    
    


    四、报错信息:HTTP Error 502.5 - Process Failure
       第一次启动项目IIS配置好以后如果提示HTTP Error 502.5 - Process Failure 可以试试调试项目,调试启动后项目就可正常访问使用

    五、报错信息:HTTP 错误 403.14 - Forbidden
       很有可能是IIS物理路径配错,仔细检查

    六、asp.net core linux系统下发布


    1、先安装putty远程登录工具、把pasp.exe文件放在C:WindowsSystem32下然后安装

    2、发布到本地文件夹:打开发布窗口后,点击文件按钮,后面的操作跟asp.net发布一样。

    ★注意包文件要删除两个config文件,app.config、项目名.dll.config

    3、
    打开putty,输入hostName ,点击open,打开连接窗口
    login as: 账号 password:密码
    打开dos命令窗口执行以下命令,然后输入密码(命令含义:把本地E:WebSitevideoup.vsofo.com文件夹复制到88服务器/dotnet/webapp/)
    pscp -r E:WebSitevideoup.vsofo.com root@192.168.0.88:/dotnet/webapp/
    输入密码 

    4、网页登录http://192.168.0.88:8888/ 后restart站点  (服务器地址)

    输入账号密码

  • 相关阅读:
    Petapoco 数据库操作类
    .net Cookie操作公共方法 CookieHelper
    .net 服务端缓存 Cache/CacheHelper
    Base64加密解密方法
    对多字段进行去重 ( Linq 方式 )
    BootStrap之 提示工具(Tooltip)插件
    bootstrap之弹出框
    Jquery 强大的表单验证操作
    强大的数据库工具 dbForge Studio ForMySql
    My操作小技巧
  • 原文地址:https://www.cnblogs.com/xiaoxiaoqiao/p/10150481.html
Copyright © 2011-2022 走看看