Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deploy app on IIS Server? #711

Closed
mihir0x69 opened this issue Jul 13, 2016 · 9 comments
Closed

How to deploy app on IIS Server? #711

mihir0x69 opened this issue Jul 13, 2016 · 9 comments
Labels

Comments

@mihir0x69
Copy link
Member

I have back-end API written in ASP.NET Web API 2.0. I'm trying get this boilerplate work with it. What is the best way to deploy this app to IIS express or IIS Server? After building the react app I get a dump inside build directory. Do I directly serve that directory on IIS Server?

@mxstbr
Copy link
Member

mxstbr commented Jul 13, 2016

I've never used IIS, so I can't really help you here I'm afraid!

I'll leave this open for a while, maybe somebody can chime in. Generally I recommend to ask questions in the Gitter channel since you'll get your answers much faster: https://gitter.im/mxstbr/react-boilerplate

@tobyl
Copy link

tobyl commented Jul 13, 2016

I have limited experience with IIS, however since the build folder simple contains html and js files you should have no problem with any server capable of serving HTML and JS.

One minor issue I ran into when setting up is that the .htaccess file included in the build folder is needed for routing to work fully - in my case I could view the home page and navigate via links, but if I tried to type the URL to a specific page I would see an error. To solve this I enabled mod_rewrite - a Google search should reveal plenty of information about how to set this up on IIS.

Hope this helps.

@mihir0x69
Copy link
Member Author

@mxstbr alright, I'lldo that. Thanks @tobyl. I'll try to serve build directory on IIS express first thing tomorrow.

Please keep this issue open for now. Thanks again for the help!

@tobyl
Copy link

tobyl commented Jul 13, 2016

no problem - let us know if it works. :)

@mihir0x69
Copy link
Member Author

It worked! As correctly mentioned by @tobyl I had to override default URL settings. I couldn't figure out how to do it using IIS URL rewriting module. Instead I wrote the rules in web.config of ASP.NET project.

Another way is to create an empty MVC application and configure default routing in routeConfig.cs. You can find snippets on StackOverflow for the same.

Hence closing the issue.

@aogut
Copy link

aogut commented Mar 10, 2017

do you mind sharing the web.config or put up an empty boilerplate app on github? thanks

@siddhanttambe
Copy link

+1 to @aogut 's comment.. Your boilerplate would really help.

@mihir0x69
Copy link
Member Author

mihir0x69 commented Mar 28, 2017

@aogut @siddhanttambe Here's the part of web.config-

  <system.webServer>
    <rewrite>
      <rules>
        <rule name="React Routes" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
          </conditions>
          <action type="Rewrite" url="/" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

@lock
Copy link

lock bot commented May 29, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants