i have a ASP.NET website with .NET6, i update all my Nugget Package and now i can't show .cshtml file at runtime.
I have error in output :
Exception thrown: 'Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.CompilationFailedException' in System.Private.CoreLib.dll
And when i try to show a page the page show :
Metadata file could not be opened 'C:...\bin\Debug\net6.0-windows\krbcc64.dll' -- PE image doesn't contain managed metadata
#page
Metadata file could not be opened 'C:...\bin\Debug\net6.0-windows\krb5_64.dll' -- PE image doesn't contain managed metadata
#page
Metadata file could not be opened 'C:...\bin\Debug\net6.0-windows\k5sprt64.dll' -- PE image doesn't contain managed metadata
#page
Metadata file could not be opened 'C:...\bin\Debug\net6.0-windows\gssapi64.dll' --PE image doesn't contain managed metadata
#page
Metadata file could not be opened 'C:...\bin\Debug\net6.0-windows\comerr64.dll' -- PE image doesn't contain managed metadata
When i remove the line
.AddRazorRuntimeCompilation()
it works fine but I don't have the hot reload on my cshtml file.
The error appeared last week.
Anyone have idea ?
Thank's !
Related
I am following the documentation to add frontmatter data to an html-turned into .njk file and when I save the file, the metadata gets parsed and it gets rearranged in this format :
-- -title : My page title
layout : 'base.njk'
-- -
Do I need to install any VS extension so that the metadata functions correctly on my files ?
I have images and I want to load them to my appplication.
my_app/lib/... - here my source files
my_app/assets/images/... - here my images
I need to get list of files in assets/images/ and after that show some of them (according to other logic)
I'm trying this
final dir = Directory("assets/images/");
print(dir.existsSync()); // <---- it also print: false
var files = dir.listSync().toList();
files.forEach((e) => list.add(MyImageItem(e.path)));
The problem is: I recieve exception
FileSystemException: Directory listing failed, path = 'assets/images/'
(OS Error: No such file or directory, errno = 2)
I've tried different ways: assets/images/, images/, images and so on
My pubspec.yaml
flutter:
assets:
- assets/images/
- assets/
When I create Image directly all is fine
new Image(image: AssetImage("assets/images/cat.png"))
I knew that previously (month ago) each resource has to be declared in pubspec.yaml directly, but now assets/images/ is ok.
I can load file by direct path. Why I can't access a directory? How to get list of files in directory to get them from my code?
When you add files to your assets, it means that you already know their paths.
Store all the images paths in a list and access them whenever you need.
For example if you have 3 images in
your_app/assets/images/image1.jpg
your_app/assets/images/image2.jpg
your_app/assets/images/image3.jpg
create a list and store all of them like:
List<String> imagePaths = ['assets/images/image1.jpg', 'assets/images/image2.jpg', 'assets/images/image3.jpg'];
and for example if you want to access your first image, use
AssetImage(imagePaths[0])
I keep a json file inside assets which records the file tree of assets folder.
When file list is needed, I just read from the json file.
Such json file can be easily generated by code.
However, this does not solve your problem directly when u have 5-10k images.
Only one json file might be too large to read.
Images should be grouped and recorded in separated json files.
I have build App in C# MVC and I'm using HTML5 Application cache manifest for run application even if internet unavailable. my code is as below.
Controller (Home):
public ActionResult Manifest()
{
Response.ContentType = "text/cache-manifest";
return View();
}
View (Manifest.cshtml)
CACHE MANIFEST
NETWORK:
*
CACHE:
~/Scripts/stylesheets/bootstrap.min.css
FALLBACK:
#{
Layout = null;
}
Layout.cshtml
<html manifest="/Home/Manifest">
But i am getting Error : Application Cache Error event: Failed to parse manifest
does i need to include view.cshtml files path in Cache in Manifest file?
I have tried some solution posted earlier in stackoverflow but not found any solution.
I have resolved this issue in visual studio for MVC application. follow below steps:
I have created .appcache file in notepad and copy manifest file content into it. (you don't need to create .Manifest file OR Manifest.cshtml view. just create .appcache file in notepad.)
give reference as <html manifest="~/example.appcache"> in view and issue will be resolved
I uploaded .doc to smashworld, and got the warning while validating the .epub
ERROR toc.ncx 15 43 Error while parsing file 'different playOrder values for navPoint/navTarget/pageTarget that refer to same target'.
ERROR toc.ncx 15 265 Error while parsing file 'different playOrder values for navPoint/navTarget/pageTarget that refer to same target'.
And here is part of the codes.
Shan Hai Legend Vol.1, [Part 1of2]Midpoint
I have no idea..how it can be fixed. Can anybody help me out?
As you probably know a ePub file is like an archive of files. It contains the textual files (usually .xhtml, .html), the stylesheet files (usually .css), the images used in the book and the configuration files. Your toc.ncx (The file that contains the index order and structure) has 2 or more items with the same playOrder or is corrupted.
The playOrder property specifies the actual position of the Chapter in the index.
If you use playOrder="1" with chapter 1 and playOrder="1" with chapter 2, the ePub reader doesn't know what to put first.
I suggest you to download Calibre, import your ePub, check for errors, and open the toc.ncx to see its structure.
You will get something like that:
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="it">
<head>
<meta content="...." name="...."/>
</head>
<docTitle>
<text>Book Title</text>
</docTitle>
<navMap>
<navPoint id="num_1" playOrder="1">
<navLabel>
<text>Chapter 1: some title</text>
</navLabel>
<content src="chapter-01.html"/>
</navPoint>
<navPoint id="num_2" playOrder="2">
<navLabel>
<text>Chapter 2: some title</text>
</navLabel>
<content src="chapter-02.html"/>
</navPoint>
</navMap>
</ncx>
Just check if every playOrder is incremented by 1 for each navpoint.
If you find the error, manually insert the correct values, save and export the eBook.
If you don't know how to fix it, post here the toc file and we will try to understand the mistake :)
I'm learning swagger, trying to make a little change and see if it can be reflected on index page. So the starting point is the index.html page, I made a copy of it from the jar file :
C:\swagger-ui\target\swagger-ui-2.1.0-M1\WEB-INF\lib\swagger-ui-2.1.8-M1.jar
and saved the new page as index2.html, added a line to the html content inside, and added it to the above jar file.
But I've noticed it has a .gz file for the original index.html file, don't know its purpose, so I also made a file called index2.html.gz and added it to the above jar file, then run the jetty server, and loaded the index.html :
http://localhost:8080/swagger-ui/webjars/swagger-ui/2.1.8-M1/index.html
It showed up alright, then I tried to load : index2.html, but it couldn't find the page, why ? Where should I include it so it will show up at : http://localhost:8080/swagger-ui/webjars/swagger-ui/2.1.8-M1/index2.html
The error message is :
HTTP ERROR 404
Problem accessing /swagger-ui/webjars/swagger-ui/2.1.8-M1/index2.html. Reason:
Not Found
What exactly are you trying to change in the Swagger-UI? I have been messing around with branding/customizing Swagger myself. If you take a look at the swagger-ui.js file you will see that it is 30,000+ lines of code and poorly organized. They are also using handlebars and backbone.js which I am not familiar with. I added some custom features by simply manipulating the DOM once the page had been rendered. I did this by writing a JS file that was added to the index.html.
I got it done with the following steps :
[1] Create : C:\swagger-ui\petstore
[2] Copy swagger.json into it [ This is where you can customize ]
[3] Copy the index.html and save it as : Swagger_Test.html into C:\swagger-ui\src\main\webapp [ This is where you can customize ]
[4] Unpack swagger-ui-2.1.8-M1.jar into : C:\swagger-ui\src\main\webapp
[5] Create C:\swagger-ui\src\main\webapp\css and move the *.css and *.css.gz files mentioned in the original index.html file from C:\swagger-ui\src\main\webapp to C:\swagger-ui\src\main\webapp\css
[6] Create C:\swagger-ui\src\main\webapp\lib and move the *.js and *.js.gz files mentioned in the original index.html file from C:\swagger-ui\src\main\webapp to C:\swagger-ui\src\main\webapp\lib
[7] Maybe move another few files in the original index.html file from C:\swagger-ui\src\main\webapp to C:\swagger-ui\src\main\webapp\css or C:\swagger-ui\src\main\webapp\lib
[8] Comment out the following from the pom file
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>2.1.8-M1</version>
</dependency>
[9] In the Swagger_Test.html file
replace : url = "http://petstore.swagger.io/v2/swagger.json";
with : url = "/swagger-ui/petstore/swagger.json";
[10] Recompile and start the server
[11] Load page : http://localhost:8080/swagger-ui/Swagger_Test.html
or : http://localhost:8080/swagger-ui/Swagger_Test.html?url=http://localhost:8080/swagger-ui/petstore/swagger.json