madskristensen / Miniblog.Core

An ASP.NET Core blogging engine
https://miniblogcore.azurewebsites.net/
Other
1.48k stars 498 forks source link

Miniblog won't work as IIS application #40

Open robalexclark opened 7 years ago

robalexclark commented 7 years ago

I've been trying to work out what is special about the miniblog.core routing/setup that stops it working as a IIS application (works fine when published to a root IIS site. Miniblog is unable to find Views and css files for example, but I'm unable to understand why ¯_(ツ)_/¯ Can anyone help/give me some pointers? Thanks.

eddynaka commented 7 years ago

Hi,

do you have any error or something like that?

On Sat, Nov 18, 2017 at 9:57 AM, robalexclark notifications@github.com wrote:

I've been trying to work out what is special about the miniblog.core routing/setup that stops it working as a IIS application (works fine when published to a root IIS site. Miniblog is unable to find Views and css files for example, but I'm unable to understand why ¯(ツ)/¯ Can anyone help/give me some pointers? Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/madskristensen/Miniblog.Core/issues/40, or mute the thread https://github.com/notifications/unsubscribe-auth/APctZA-NFqajBTddWyQnCLeggUy3CWexks5s3sYlgaJpZM4Qi-mU .

-- Eddy Nakamura

eddynaka commented 7 years ago

ok. found the problem. i will make a pull request with that.

the css paths aren't dynamic, so it will go always to root iis website.

robalexclark commented 7 years ago

Yes it fails at the first css it finds (which is belowthefold.css). Thanks for looking into this for me.

eddynaka commented 7 years ago

Can you send me a picture?

I found other errors but I still can't reproduce yours.

robalexclark commented 7 years ago

OK, the first error after publish is this (complaining about access to ob folder)j:

Content root path: C:\inetpub\wwwroot\MiniBlog Now listening on: http://localhost:33208 Application started. Press Ctrl+C to shut down. fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0] An unhandled exception has occurred: Access to the path 'C:\inetpub\wwwroot\MiniBlog\obj\WebOptimizerCache' is denied. System.UnauthorizedAccessException: Access to the path 'C:\inetpub\wwwroot\MiniBlog\obj\WebOptimizerCache' is denied.

Sooo, I manually created an obj directory and granted write access, but still no joy as the next error encountered is:

System.IO.FileNotFoundException: No files found matching "/MiniBlog/css/belowthefold.scss" exist in "C:\inetpub\wwwroot\MiniBlog\wwwroot\" at WebOptimizer.Asset.ExpandGlobs(IAsset asset, IHostingEnvironment env) at WebOptimizer.Asset.GenerateCacheKey(HttpContext context) at WebOptimizer.Taghelpers.BaseTagHelper.GenerateHash(IAsset asset) at WebOptimizer.Taghelpers.LinkTagHelper.Process(TagHelperContext context, TagHelperOutput output) at Microsoft.AspNetCore.Razor.TagHelpers.TagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output) at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.d__0.MoveNext()

eddynaka commented 7 years ago

How are you generating this files?

Are you copying / pasting from source folder?

On Sat, Nov 18, 2017 at 3:02 PM, robalexclark notifications@github.com wrote:

OK, the first error after publish is this (complaining about access to ob folder)j:

Content root path: C:\inetpub\wwwroot\MiniBlog Now listening on: http://localhost:33208 Application started. Press Ctrl+C to shut down. fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0] An unhandled exception has occurred: Access to the path 'C:\inetpub\wwwroot\MiniBlog\obj\WebOptimizerCache' is denied. System.UnauthorizedAccessException: Access to the path 'C:\inetpub\wwwroot\MiniBlog\obj\WebOptimizerCache' is denied.

Sooo, I manually created an obj directory and granted write access, but still no joy as the next error encountered is:

System.IO.FileNotFoundException: No files found matching "/MiniBlog/css/belowthefold.scss" exist in "C:\inetpub\wwwroot\MiniBlog\ wwwroot" at WebOptimizer.Asset.ExpandGlobs(IAsset asset, IHostingEnvironment env) at WebOptimizer.Asset.GenerateCacheKey(HttpContext context) at WebOptimizer.Taghelpers.BaseTagHelper.GenerateHash(IAsset asset) at WebOptimizer.Taghelpers.LinkTagHelper.Process(TagHelperContext context, TagHelperOutput output) at Microsoft.AspNetCore.Razor.TagHelpers.TagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output) at Microsoft.AspNetCore.Razor.Runtime.TagHelpers. TagHelperRunner.d__0.MoveNext()

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/madskristensen/Miniblog.Core/issues/40#issuecomment-345455501, or mute the thread https://github.com/notifications/unsubscribe-auth/APctZISjhfq4XuCxJc34ficWwvd-WN7Eks5s3w29gaJpZM4Qi-mU .

-- Eddy Nakamura

robalexclark commented 7 years ago

I'm turning on logging in the web.config - the output is from the stout log files.

eddynaka commented 7 years ago

i think you need to do something like https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore2x

when you publish it will automatically generate some files.

in my case, using windows, it generated:

[image: Inline image 1]

On Sat, Nov 18, 2017 at 4:22 PM, robalexclark notifications@github.com wrote:

I'm turning on logging in the web.config - the output is from the stout log files.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/madskristensen/Miniblog.Core/issues/40#issuecomment-345460817, or mute the thread https://github.com/notifications/unsubscribe-auth/APctZJHtBZAK3tTkVJDey1ZV4PdHJdX7ks5s3yBigaJpZM4Qi-mU .

-- Eddy Nakamura

robalexclark commented 7 years ago

I've been using webdeploy to deploy to the IIS server, which runs dotnet publish then copies the output to the IIS application directory. This is the way I've been publishing other netcore 2.0 apps and they work fine. Whatever is stopping miniblog.core working as an IIS application must be due to the way it is setup/configured within the code.

I did however run dotnet publish and manually copy the files but the error is the same.

iqmeta commented 6 years ago

same here, look to me like this one https://github.com/ligershark/WebOptimizer/issues/73 => ~/ is might not resolved for subfolders/iis virtual apps

https://github.com/ligershark/WebOptimizer/blob/master/src/WebOptimizer.Core/Asset.cs line 106 "/" hard root => exception => 119

bahadirekici commented 5 years ago

I've been using webdeploy to deploy to the IIS server, which runs dotnet publish then copies the output to the IIS application directory. This is the way I've been publishing other netcore 2.0 apps and they work fine. Whatever is stopping miniblog.core working as an IIS application must be due to the way it is setup/configured within the code.

I did however run dotnet publish and manually copy the files but the error is the same.

Did you find any solution ?

robalexclark commented 5 years ago

Nope - I didn't. In the end I just rolled my own mini-blog engine, but now I'm in the process of moving all this to Medium.com

bahadirekici commented 5 years ago

This is really annoying. I'm thinking of going to back MVC.

bahadirekici commented 5 years ago

My error also different;

Application started. Press Ctrl+C to shut down.
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
      An unhandled exception has occurred while executing the request.
System.IO.FileNotFoundException: No files found matching "/be/js/site.js" exist in "C:\inetpub\wwwroot\be\wwwroot\"