I have an asp.net core 2.2 application that I published on my IIS and can access it with http://10.23.44.105:891/"some path"(I modified the ip). In this app I instaled what I needed with npm and I use a bunch of stuff like requirejs, multiselect,bootstrap, etc. The problem is that apparently, the app doesn't know about my node_modules.
I assume that is something related to the webconfig or I need to tell the app that the node_modules needs to be published too.
This is my webconfig file after publishing
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\ProductManagement_WebApplication.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 1bbb425b-0e64-410d-86e5-142483a5f132-->
and this is the console with all the errors
GET http://10.23.44.105:891/node_modules/bootstrap/dist/css/bootstrap.min.css net::ERR_ABORTED 404 (Not Found)
BaseProducts:8
GET http://10.23.44.105:891/node_modules/kendo-ui/styles/kendo.bootstrap-v4.min.css net::ERR_ABORTED 404 (Not Found)
BaseProducts:13
GET http://10.23.44.105:891/node_modules/codemirror/lib/codemirror.css net::ERR_ABORTED 404 (Not Found)
BaseProducts:14
GET http://10.23.44.105:891/node_modules/codemirror/theme/material.css net::ERR_ABORTED 404 (Not Found)
BaseProducts:16
GET http://10.23.44.105:891/node_modules/bootstrap-multiselect/dist/css/bootstrap-multiselect.css net::ERR_ABORTED 404 (Not Found)
BaseProducts:34
GET http://10.23.44.105:891/node_modules/requirejs/require.js net::ERR_ABORTED 404 (Not Found)
init.js:2
Uncaught ReferenceError: requirejs is not defined
at init.js:2
Uncaught ReferenceError: require is not defined
at BaseProducts:245
Uncaught ReferenceError: require is not defined
EDIT: Something besides npm install would be helpful. Sadly I had to modify some of the js files in the node_modules because of requirejs so npm install wouldn't be the best solution. I need something to force the node_modules to be on the published app as well.
Found the solution. In the csproj of the project that you want to publish you need to tell that you want the node_modules includes. By default (I think) those are not included. So to include them you need to put this in there
`<ItemGroup>
<Content Include="wwwroot\node_modules\**"
CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
Note: Replace the path with your path to node_modules
ATTENTION. You may need to delete the other references to node_modules from there. Example:
<Content Include="wwwroot\node_modules\codemirror\addon\dialog\dialog.css" />
<Content Include="wwwroot\node_modules\codemirror\addon\display\fullscreen.css" />
<Content Include="wwwroot\node_modules\codemirror\addon\fold\foldgutter.css" />
<Content Include="wwwroot\node_modules\codemirror\addon\hint\show-hint.css" />
<Content Include="wwwroot\node_modules\codemirror\addon\lint\lint.css" />
<Content Include="wwwroot\node_modules\codemirror\addon\merge\merge.css" />
or instead of "Content"is"None"
<None Include="wwwroot\node_modules\codemirror\addon\lint\json-lint.js" />
<None Include="wwwroot\node_modules\codemirror\addon\lint\lint.js" />
<None Include="wwwroot\node_modules\codemirror\addon\lint\yaml-lint.js" />
<None Include="wwwroot\node_modules\codemirror\addon\merge\merge.js" />
<None Include="wwwroot\node_modules\codemirror\addon\mode\loadmode.js" />
<None Include="wwwroot\node_modules\codemirror\addon\mode\multiplex.js" />
<None Include="wwwroot\node_modules\codemirror\addon\mode\multiplex_test.js" />
I deleted those and put the first thing and it worked.
You may copy required node_modules to wwwroot folder of the app (e.g. with gulp script binded as "after build" action.
Contents of the wwwroot are included in publish output and accessible later on as static files.
Related
I am running an IIS instance (Not the default IIS Express) on which I have configured my ASP.NET Core 3.1 MVC project.
I would like to configure my web.config file, so that I have the following behavior:
Each time i update a view (.cshtml file) in my solution, the update is instantly visible after i refresh the page.
Each time i update a controller or a model (.cs file) the update becomes visible after a rebuild of the solution.
What I currently have is the following configuration in my root directory:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\bin\Debug\netcoreapp3.1\Live.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
Now with the following configuration I have to rebuild each time I want to see the result of my modifications. There's also another problem, each time I rebuild the app I encounter the following problem:
1>D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4502,5): error MSB3021: Unable to copy file "obj\Debug\netcoreapp3.1\Live.dll" to "bin\Debug\netcoreapp3.1\Live.dll". The process cannot access the file 'bin\Debug\netcoreapp3.1\Live.dll' because it is being used by another process.
I have to manually stop the IIS instance and then rebuild my solution.
I have worked on a project where this was the way things were done, however I never figured out how it was configured. I would appreciate any help if possible, Thanks.
I'm trying to deploy a netcore2.0 MVC app to IIS and keep getting the error above.
The file permissions are set correctly and I checked that the runtime is downloaded.
The error is as follows:
Module
IIS Web Core
Notification
Unknown
Handler
Not yet determined
Error Code
0x8007000d
Config Error
Config File
\\?\E:\Dev\test-deploy\web.config
Requested URL
http://localhost:4231/
Physical Path
Logon Method
Not yet determined
Logon User
Not yet determined
Following is my Config File (generated by vs code):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Coneckt.Web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 2833ed36-9a18-47b6-8f33-8998356796d9-->
This error occurs because the ApplicationHost.config or Web.config file contains a malformed XML element, you need to delete the malformed XML element from the ApplicationHost.config or Web.config file.
You can also refer to this link about how to deploy ASP.NET Core on IIS: Host ASP.NET Core on Windows with IIS.
I have an angular app with web api written in express and node.js.
In my angular app I am sending a http.put request to my webapi which is working perfectly fine in localhost.
But it is not working on live iis10 server and I am not the administrator. I have bought shared hosting. The error I am getting is 405 method not allowed error.
After a long research I think that some module in iis10 is not allowing http verbs. After that I have done changes to my web.config file to solve the problem.
Following are the changes that I have done in web.config file. First I have removed the webdav module in my web.config file. But after removing the webdav module I still got the same 405 error. I tried to trouble shoot the problem with failed request tracing module in plesk, the description of the error is:
ModuleName StaticFileModule
Notification EXECUTE_REQUEST_HANDLER
HttpStatus 405
HttpReason Method Not Allowed
HttpSubStatus 0
ErrorCode Incorrect function.
I have also tried to fix the staticfilemodule error in web.config file but still got the same 405 error and still got the same error in failed request tracing.
Following is the web.config file:
<configuration>
<system.webServer>
<modules>
<remove name="WebDAVModule" /> <======== done changes
</modules>
<handlers>
<remove name="WebDAV" /> <======== done changes
<remove name="StaticFile" /> <======== done changes
<add name="StaticFile" path="*" <======== done changes
verb="GET,HEAD,POST,DEBUG,PUT,DELETE"
modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>
Using IIS 10 and .NET Core 2.0
The web.config was generated from a new .NET Core MVC project.
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MvcMovie.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
With it in this configuration I can't open the configuration editor in IIS and gives a 500.19 error:
Config Source:
-1:
0:
If I remove the <aspNetCore /> node, it will open in the configuration editor in IIS but will give a 500.21 error:
Handler "aspNetCore" has a bad module "AspNetCoreModule" in its module list
What would I do to get about fixing this?
It sounds like you haven't installed the IIS Hosting bundle.
Go here: https://www.microsoft.com/net/download/all
Click the version of ".NET Core Runtime" that you need, then download the "Hosting Bundle Installer" under "Windows".
I have the following webconfig file produced by visual studio 2017 on a .net core application
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\SportsStore.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 5795049b-4d7e-4559-9010-f9134df11849-->
Although the publish succeed I get the following on the web page
Detailed Error Information:
Module
IIS Web Core
Notification
BeginRequest
Handler
Not yet determined
Error Code
0x8007000d
Config Error
Config File
\\?\C:\inetpub\wwwroot\sportstore\web.config
Requested URL
http://localhost:80/sportstore
Physical Path
C:\inetpub\wwwroot\sportstore
Logon Method
Not yet determined
Logon User
Not yet determined
Config Source:
-1:
0:
Because I have already work only on apache and the build in IIS express of visual studio I do not know where to start from. Internet has plethora of info and I tried many things but nothing.
Any suggestion?