代码之家  ›  专栏  ›  技术社区  ›  Laurence Wingo

什么是?如何在Microsoft Azure中找到主机URI?

  •  0
  • Laurence Wingo  · 技术社区  · 8 年前

    当查看来自Microsoft的RESTAPI文档时,它显示特定请求的头文件应该包含主机名。我想知道这是什么,怎么找到它?

    Microsoft says that these are the request headers:
    POST https://testrest.cloudapp.net/api/Channels('nb:chid:UUID:2c30f424-ab90-40c6-ba41-52a993e9d393')/Start HTTP/1.1  
    DataServiceVersion: 3.0;NetFx  
    MaxDataServiceVersion: 3.0;NetFx  
    Accept: application/json;odata=minimalmetadata  
    Accept-Charset: UTF-8  
    x-ms-version: 2.11  
    Content-Type: application/json;odata=minimalmetadata  
    Host: <host URI>  
    User-Agent: Microsoft ADO.NET Data Services  
    Authorization: Bearer <token value>  
    

    由于接收到一个400错误而没有主机URI,因此连接出现问题。起初我没有使用它的原因是因为邮递员没有使用它,但是他们的API调用成功了。有人知道主机URI是否必要,如果需要,我在Microsoft Azure中可以在哪里找到它?专门用于媒体服务。

    1 回复  |  直到 8 年前
        1
  •  1
  •   Lee Liu    8 年前

     HTTP/1.0 does not bring host, and HTTP/1.1 adds host head.
    
     Host can be a domain name, or IP, or port number.
    
     Host can be customized by programs. Some programs can define false host in order to prevent operators or bypass firewalls.
    
     Host in HTTP/1.1 can be null value but not without. If no host head is taken, 400 Bad request will be returned.
    
     The HTTP response header does not contain the host field.
    
     Some sites do not check host and can pass arbitrary values.
    

    testrest.cloudapp.net:433