Rebuild ASP.NET Web Application via code - c#

Currently I force ASP.NET to rebuild a web application by changing the web.config. However, I would prefer to do it via C# code (including clearing cache etc). How could I go about doing this.

Are you talking about live, on a web server? You could stop/start the application within IIS, and probably via a PowerShell or WMI script.

Used code from 'Recycling an ASP.NET Application from within' to do this via code.

Related

Deploying ASP.NET Core Web API and ASP.NET Core with Angular in a subfolder (1&1 Windows Business Hosting)

I've acquired a 1&1 Windows Business Hosting which allows to deploy ASP.NET Core applications (so yeah, I have no access to IIS solutions of building as application stuff or that kind of things I've seen in other posts). I wanted to deploy a web and an API in different subfolders within the 1&1 server I've acquired.
What I want to achieve is the following:
Imagine that my domain is https://myDomain. com.
If a user access directly that URL he should see a specific page of the Angular Web App. However, if the called is https://myDomain. com/api/controllerName it should do whatever I have programmed in that controller of the Web API.
I want to have the folder structure something like this:
But it is also valid if I manage to get it like this:
Is any of these two cases even possible to be done? If possible, how I should proceed for being able to do it? I don't have a lot of knowledge in these topics related to web deployment.
What I have managed to do up until now:
If I deploy just the ASP.NET Core Web API outside the subfolder it works with no issues. If I deploy just the ASP.NET Core with Angular outside the subfolder it also works. My issue is that I'm unable to get them both to work at the same time when at least one of them is in a subfolder.
Alternatives on how to achieve this are also welcome!
Thanks in advance :)
You can deploy ASP.NET Core Web API and ASP.NET Core with Angular in two folders as shown in the image below.
These two folders are virtual directories in IIS. If you want to specify which app to access by default, you can modify the rewrite rule in web.config under the wwwroot folder.

Blazor WebAsembly Access Database

I am just thinking that, Since Blazor Webassembly can running in browser independently(off-line), how can it access database without a WebAPI?
Can Blazor Webassembly use sqlite in browser directly?
You can use in browser DBs IndexedDB, Web SQL or local storage throught JSInteropt
How can it access database without a WebAPI?
It can't access any database without a Web Api. You can only access the JavaScript localStorage and sessionStorage Apis, using JSInterop. Right now Blazor does not support such adventures, but I'm not much acquainted with products created by third parties and the community... perhaps they've created something that can be useful for you.
No Blazor Webassembly can not use sqlite in browser directly.
Blazor Webassembly can running in browser independently(off-line),
it can access database without a WebAPI but first you have to start creating project by chossing
Blazor Web assembly project then use ASP.Net Core Hosted and Prograssive Web App selected.
Now you can use database and share logic. And for Off line capability you have to change in worker.js according to your need.
And You can use in browser DBs IndexedDB, Web SQL or local storage or JSON File

Run C# MVC application, in local web server

I've made a C# ASP.NET Application using VS 2013. What I want to do is use it on my localhost using IIS.
How do I do it work? When it go to localhost, it just appears a black page.
I've created a new site on IIS Manager and ponted it to de fisical path of my application. Registered the ASP.NET on IIS...
I've tried whats in the How do you publish an ASP.net MVC application from Visual Studio 2013 to your local network? .
So, I don't need to use IIS, I could use other web server, like Apache...
I want to be able to open Chrome, go to localhost:8080/ for example and get my application, without having to open VS and run the project etc...
Also, if other people could access the application on my local network, it would be great. I just want to use my MVC web aplication like it was on the internet itself, like I can access google.com and use it, but I want to do so in my local network only.
If I try to access a simple HTML file, using IIS, it works perfectly. Now I want to use my C# MVC web application.
Is there a way to do this? Using IIS, Apache, whatever...

Silverlight WebApp Calling Webservice in the same solution

I have a website solution that is composed of a Silverlight Project and an ASP Site that contains an asmx Webservice.
The Silverlight project calls various methods in the Webservice, and this works fine on my home PC.
When I publish the site (using 123-Reg if that makes a difference), it appears that the Silverlight app is no longer able to call the webservice. I have tried debugging the app by pointing my local version of the site to my published webservice and I get a "policy" issue.
I know that 123 Reg have .Net 3.5 running on their servers, so I would assume that the site should "just work" when I publish it. Am I making a hugely stupid assumption there? Is there anything that I can do to change the "policies" within my app? Or is there another way around what I am trying to do? I need to keep the webservice, as I want for it to be used from other places, and don't really want to duplicate code and create the same methods within the Silverlight project.
Thanks
Soundlike you are hitting a crossdomain issue, though you shouldn't really.
I would stick a clientaccesspolicy.xml in the root of you web server.
There are loads of questions on SO if you need examples or MSDN

Integrating a non-ASP.NET application with IIS?

Basically I want to integrate an application written in C# with IIS, and this application is not created with ASP.NET but has the ability to output HTML - so what I'm after is hooking into IIS somehow and catching all requests to a "Web Site" (IIS-concept) and allowing my custom application to handle them.
I honestly have no idea where to even start looking at this sort of thing, so any help is appriciated.
tl;dr-version: How would I go about creating something aching to an apache module for IIS ?
You can do something like this by creating an HttpHandler.

Categories