Deploy Prerender Service on local - prerender

I installed prerender middleware on my asp mvc + angularjs project, it connects to service.prerender.io but I want to use my own prerender service.
how can I run prerender service on port 3000 on my local server ?

The code for the open source server is here: Prerender Github
The installation instructions are there on the Github page. You would then set the prerenderServiceUrl property of your middleware to point it to http://localhost:3000 or wherever you are running your own Prerender server and all requests would go there instead of our hosted service.

Related

Asp.Net Mvc bundled scripts are hanging in IIS on RequestAcquireState

I have recently encountered an issue with some of the javascript requests are hanging in the RequestAcquireState inside IIS worker process request listing grid. In the application, I am bundling the scripts and style sheets, with Cdn=True, EnableOptimization=True and Compilation debug = false in the hosts config.
Now, with CDN = true, I initially thought when using the below:
#Scripts.RenderFormat("<script src=\"{0}\" type=\"text/javascript\"></script>", "~/bundles/vendor/kendo/js")
The request will be made from the browser to CDN (https://www.jsdelivr.com/) in this case. However, it is hitting our host.
So just wandering the how Scripts.RenderFormat internally works?
Does it make a request via IIS to grab content from the CDN and then sends it to the browser?
Is Scripts.RenderFormat tying to access a session?
Any solution to these requests donot lock on RequestAcquireState state
Image from the IIS is attached below:
Click here to see IIS request log
Thanks

Service worker fetch event is never fired

I am developing Progressive Web Apps with Laravel. I have referred PWA with Laravel for developing. In that first I generated service worker, then updated laravel mix after that set manifest file. In the layout I checked for service worker and push notification support. After registering service worker, install and activate are successfully triggered but fetch event is never triggered even when the browser set to offline as in the image browser offline. Also referred this video PWA LARAVEL. Code for package.json file is as shown in the image: package.json code for webpack.config.js file is: webpack.config.js, section of code in the blade(view) for registering service worker is:service-worker registration. Service worker is generated in public folder of my laravel project. I am new to Laravel and PWA. Thank you.
I got the answer. Actually in my laravel project I had removed public from url. But service worker will receive fetch events for everything on its domain; that is if we register the service worker file at /example/sw.js, then the service worker would only see fetch events for pages whose URL starts with /example/ (i.e. /example/page1/, /example/page2/). So I should change my url pattern to public. Thank you.

Any modification necessary to web api project web.config when web api project is created as a web application under an asp.net web site?

I have an asp.net web site which runs on port 443 which is https. I also have a asp.net web api which also needs to run on port 443. Because of that, I decided to create a new web application under asp.net web site. I also created a new application pool for that. The problem is that when I try to run web api project, I keep getting configuration file errors. For example it says Default Connection is already added since asp.net web site web.config adds Default Connection already before web api project does. Are there any special steps to take in order to make this work?

ScriptManager service reference generates JS code that forgets about the service host name

I'm working on an ASP.NET project that uses AJAX to communicate with an ASMX web service. One of the pages uses a ScriptManager to reference the web service ASMX file. It's referenced using an absolute URI.
I recently changed both the ASP.NET project and web service to use IIS Express. Each now has a different port number. Since this change, the client-side code for the ASP.NET project can't access the web service.
The generated HTML code for the ASP.NET page contains a correct reference to the web service:
<script src="http://localhost:2837/Service.asmx/jsdebug" type="text/javascript"></script>
However, this script only refers back to the web service using a relative URL instead of an absolute one:
Service.set_path("/Service.asmx");
So AJAX calls to web service methods fail because the hostname from the ASP.NET application is used instead of the web service's:
POST http://localhost:2827/Service.asmx/WebServiceMethod 500 (Internal Server Error)
Notice that the port number above is different to the one used by the web service. The above port number is the one used by the web application.
The HTTP 500 is produced because the web server is reporting:
No web service found at: /Service.asmx
How can I fix this so that the web service is referenced correctly?
From Exposing Web Services to Client Script:
The ServiceReference object can reference a Web service only in the
same domain as the page. The Web service path can be relative,
application relative, domain relative, or absolute. For absolute
paths, you must make sure that the path is in the same domain.
So you can't call your web service method which is in another domain. What you can do is create another service in your asp.net project to call the original web service. then you can call newly created web service method from script manager

How to make Asp.Net ignore my physical directory?

I'm creating my first FubuMVC application. I've got a physical folder Demo and a route that should handle the "/demo" url. For some reason, when I try to debug it in Visual Studio, it issues a permanent redirect to "/demo/", and then returns HTTP Error 404.20 - Not Found (No default document). When I route the same action to /demostuff, everything works just fine. I noticed that my application startup scripts are fired on the first request, but it's somehow not routed to Fubu's HttpHandler.
I'm using IIS Express.

Resources