I'm currently developing an app in Angular with an ASP.NET backend. I've configured the project to work fine locally in IE11 (Update polyfills, browserlist, and add ES5 TsConfig files), but when I've published it to the server via IIS the page will not load and is stuck at "Loading..."
To test out publishing I've attempted to publish the default Angular/ASP.NET app to the same results.
The console displays four errors:
SCRIPT1002: Syntax error
runtime.458556a34b891ea32398.js (1,1)
SCRIPT1002: Syntax error
polyfills-es5.7119ad0e4b3aeae98a0b.js (1,1)
SCRIPT1002: Syntax error
polyfills.4efda4a4618e08b621be.js (1,1)
SCRIPT1002: Syntax error
main.59969322f93fb24d6bee.js (1,1)
polyfills.ts
import 'classlist.js';
import 'web-animations-js';
import 'zone.js/dist/zone';
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular 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>
<defaultDocument enabled="true">
<files>
<add value="ClientApp/dist/index.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
your application may throw errors in IE11, even when it is working fine in other browsers. There can be numerous reasons why your Angular application is not working, including:
Missing polyfills in polyfills.ts.
Using a TypeScript target version which IE11 does not support
Importing third-party dependencies using a TypeScript target version
which IE11 does not support
Refer this : https://medium.com/better-programming/how-to-fix-your-angular-app-when-its-not-working-in-ie11-eb24cb6d9920
Thanks #Deepak-MSFT for the answer, turns out I didn't have the .NET Hosting Bundle installed on the host machine. Once I installed that, the website displayed as it was supposed to -- barring a couple issues not related to what I'm talking about here.
For those curious, I was having issues with database connection string, I found another project being hosted on the server and modified its connection string:
data source=[database];initial catalog=[table];persist security info=True;user id=[user id];password=[password];MultipleActiveResultSets=True;App=EntityFramework
I also removed the web.config file I'd created, as it would probably get in the way of the one generated during publishing.
Related
After npm run serve everything's working fine. After i deployed my app with API in ASP.NET application doesnt scale at all. I use Router and History. Authentication for annonymous users is enabled and static content is installed. Console doesn't show any errors.enter image description here
Links to screenshots:
Local run
IIS
What do you mean that vue.js not scaling? The second component display abnormally, is it right?
It might be something wrong with Javascript code snippets working.
Did you install the URL Rewrite extension in IIS and add the below rules in the webconfig file?
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/500" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.html" />
</rule>
</rules>
</rewrite>
Here is URL Rewrite extension.
https://www.iis.net/downloads/microsoft/url-rewrite
I have a really harsh time trying to get Symfony 3 app work on IIS as website subdirectory.
Structure on IIS :
Application is called pfc and its poiting to directory pfc/web, (IIS is hiding root, because folder name is same as app)
This is web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="app_dev.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<clear />
<rule name="StaticFiles" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile"/>
</conditions>
<action type="Rewrite" url="{R:0}" logRewrittenUrl="true" />
</rule>
<rule name="Symfony 3" enabled="true" stopProcessing="true">
<match url=".?" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="./app_dev.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Entering dev.erp.loc/Test2/pfc ends up with:
like Symfony thinks of itself as a root application, which is not.
My best shoot was to use router.request_context.base_url, but it looks like it worked only in S2.
Now im stuck on something i can call half-way solution
By comment rewrite section in web.config i was correctly redirected to Identity Server, but after log in i get :
In order to fix it, i needed to uncomment rewrite section, to make routing work again, but it works only for browser, leaving it in this state will cause "no route found" in anther browser.
It would be nice to fix subdirectory routing in parameters.yml, which I fill anyway in deploy script, but if there is no other way I can edit web.config too.
Recently I needed to take care of similar issue and as side effect I solved this "problem". My URL without trailing slash is correct. The issue was that Chrome couldn't create canonical url form and made request to endpoint that Symfony don't need to interpret
I upgrading my project to ASPNET5. I'm hitting a snag regarding upgrading my web.config file.
I tried using Microsoft.Framework.ConfigurationModel.Xml package to read a URL Rewrite configuration. The config looks like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="MainRule" 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}" matchType="Pattern" pattern="api/(.*)" negate="true" />
<add input="{REQUEST_URI}" matchType="Pattern" pattern="signalr/(.*)" negate="true" />
</conditions>
<action type="Rewrite" url="default.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
but of course I'm getting duplicate key issues when it tries to convert it to the object that aspnet5 uses.
Whats the best way to port your existing web.config to the new aspnet model? This is a small case I realize but in the real world these configs are really intense.
I've created an example project that I'm hoping to share with others when i get a few of these cases figured out.
the web.config file you posted only has url rewrite rules for iis. Do you really need to access those from your app? IIS will read those directly from the web.config but you shouldn't need that stuff in your app so you don't need to try to parse that file with the new classes in Microsoft.Framework.Configuration at all.
if your app needs some other settings then you might as well use a json.config file as shown in many examples for your own application settings.
you can still drop that web.config file into the application root and assuming your app is hosted in IIS it should still do its job and tell IIS to do some url rewriting. you should not rename it to config.xml as it appears you have done, since IIS won't notice the file unless it is named web.config
why would you need to access those url rewrite rules from application code at all since it is IIS and not application code that does the url rewriting?
I think the new paradigm is use json.config and/or environment variables in azure for application configuration
The only thing you might still use a web.config file for is IIS configuration but that is separate from application configuration and that is the only thing you would use web.config files for going forward and you should not need to access web.config file from application code at all.
I am trying to configure the silex framework and just get an example application working. I am using an IIS server version 7.5 to do so. On the following website it gives me a sample web.config file I should be using. The file is as follows:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Silex Front Controller" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
The problem is when trying to navigate to the website I just get the error:
The requested page cannot be accessed because the related
configuration data for the page is invalid.
So essentially IIS says the file is incorrect but I don't have much experience with these files so I don't know if there is a problem. Maybe the file is outdated and the newer doesn't work with newer versions of IIS. There is nothing in the server logs. Anyone come across this problem before?
Turns out I just needed to install the rewrite module for IIS at the following link:
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module
I have just installed WordPress 3.0.1 running on MS IIS 6 Windows Server that I developed from my Mac OS X platform.
Note that my WordPress setup is under the following directory structure:
c:\inetpub\wwwroot\MYSITE
The problem here is though, with the site up and running, it can't seem to find any of my pages like "About Us" even though I have set them up correctly within the permalinks side of things.
I am getting:
HTTP Error 404 - File or directory not found. Internet Information Services (IIS)
Is it something to do with permalinks/.htaccess file not working on MS II6?
.htaccess files are for Apache HTTPD. They don't work with IIS. For IIS you need to create a "Web.config" file and add the following lines to it.
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
DOESN'T WORK IN IIS6:
As Kev points out, this code doesn't work in IIS6. From a little googling I understand that URL rewriting is not at all possible with IIS6. If anyone knows another way, please update here.
POSSIBLE ALTERNATIVE FOR IIS6?
Is it possible to use ISAPI_Rewrite or UrlRewriter.NET in this situation? Can someone clarify on this?