"WeChat Mini Game Remote Server Local Construction" - local construction of IIS static file server

foreword

Students who develop games often encounter the following situations: when the package body is larger than the platform limit, they are not allowed to be packaged and released; it is recommended to load unnecessary resource files remotely; when opening the development version of the package, there is no suitable server for us to place Remote resources and more. Of course not just the above two cases, we may have to or may wantMove the remotely loaded resources from the main package body to the built remote server. Buying a server or building a public server requires cost, so today, I will teach you how to build an IIS server locally for storing remote resource files.

Build the background

Why would you want to build such a server? Because when I was developing a small game on the WeChat platform, on the one hand, because the project package volume exceeded the platform limit, on the other hand, it was also to give players a better game experience. Following the suggestion of the engine team, I put the packaged resource file res on the remote server. Because I am usually responsible for the packaging of the development version, the working group did not have a separate public file server environment before, so I wanted to build a server by myself to meet the needs of the development version.

build requirements

1. Meet the resource placement conditions and access safely and smoothly
2. Meet other real machine access in the LAN

build process

The whole process was very smooth, with almost no pitfalls.

  1. According to the Baidu experience entry, build an IIS server, link: [Baidu Experience] Diagram how to build an IIS file server .
  2. At this point, you can already change the remote server address of the project to the address we can access in step 1, which is your local ip+path such as "http://" (note that the front is ip, and the back is your server 192.168.* .* /wx/miniGame/file The path of the directory, that is, your res file is placed in the miniGame folder, to verify whether it can be accessed, just open this link in the browser to have a look).
  3. But at this time, you can indeed access remote resources, but you will find warnings or errors on the WeChat debugging tool that some resource downloads fail. At this time, if you open the path of these resources in the browser, you will find such log information on the browser.
    " HTTP Error 404.3 - Not Found The page you requested cannot be served due to an extension configuration problem. If the page "
    insert image description here
    then, it is likely because of the mime policy settings. Because the server used by Creator is express, not IIS, so the MIME of IIS is not configured with json files.
    Please see this classmate's article, link HTTP Error 404.3 - Not Found The page you requested cannot be provided due to extension configuration problems
    Follow the article's tutorial to set the file format that cannot be downloaded correctly in your remote file resource package:
    file Extension: .json
    mime type: application/.json
    File extension: .atlas
    mime type: image/.atlas
    (If you don’t know the mime type, you can search the mime type collection online, if you haven’t, then you need to use its type to guess the settings)
  4. After the local WeChat debugging tool is completely ok, you may not be able to access it in the same LAN at this time. You can use the test machine to try to access the ip of our server. If you can access, there is no problem; if there is no response, then It may be the firewall setting problem of our server host, please refer to step 5 for the solution.
  5. Download BMFont, link: [Baidu Experience] The IIS website can be accessed locally, but other machines in the LAN cannot access it .

end

This is the entire construction process. If there is anything you don’t understand or can’t solve, please contact me. Do my best to give you what you need.
In addition, if you are interested in cocos game development, welcome to join the group
insert image description here

Guess you like

Origin blog.csdn.net/weixin_36760331/article/details/106279263