I'm trying to understand if there is a way to make a web application run on the local computer(browser) without IIS.
My main objective is to transform my web application (that is on the internet) to a software that runs on the local computer without using the internet and without IIS.
My idea is to distributed my webapp between my colleagues and not forcing them to work online and not needing an internet connection.
I have a MVC web app with 3 pages and a couple of methods on the server side.
The idea of the application is to get proprieties from a form that I implemented on one of the pages of my web application and transform the proprieties on the client side to JSON and send it to the server, the server will generate XML file according to the JSON object and let the client download the XML file that were generated.
The flow of it:
1.The Client fill the form in my site.
2.The form become JSON object on the client side.
3.The JSON object that stored the properties of the form(filled by the client) is send to the server.
4.The server get the JSON object and generated XML document from it.
5.The client download the generated XML file.
Very simple web application.
I know that I can run HTML page by clicking it and the page will display on the browser but I need the server side to be working too to carry out actions.
So my question is : How can I make my web application run without internet ?
With the constrains:
No IIS required.
Working with .NET 4.0. (OWIN 2.0 - Not good)
No internet require.
No installation required to the computer ill pass this web app.
The server side code wont be expose when I send this application to my friends.
I read a couple of articles about OWIN, SingalR, Cassini and WCF but its all very vague...
If someone could provide me with a guide lines it will be very helpful.
Thanks a lot.
You can definitely self host a .NET web application using OWIN. Unfortunately documentation and information about it is vague and confusing at best. The fact that you're using MVC makes it somewhat easier as you may be able to directly use the self-host packages from Nuget for self hosting Web API. There may be similar packages for MVC.
I don't have recent experience but a Nuget search for "MVC Self Host" should yield some results.
Below is a link with an example. But the term you are looking for is definitely "self host". It can be done via a console window or (more complex) a windows service. It will likely use some form of OWIN but you can probably find some startup code to copy and paste into your project, usually in the form of a Startup.cs file.
http://www.c-sharpcorner.com/UploadFile/4b0136/working-with-owin-hosting-and-self-hosting-in-Asp-Net/
Related
When I study the RazorPage documentation, I read the paragraph below:
In the terminal window, copy and paste the following command
dotnet new webapp -f net6.0
This command creates the files for a basic web
API project, along with a C# project file named RazorPagesPizza.csproj
that will return a list of weather forecasts.
So what does "weather forecasts" really refer to?
I suspect it's a typo/copypasta error on the part of the person who wrote the docs, importing content from documentation about a different different kind of project.
Quite a few of the Microsoft example app templates use a weather forecast to demonstrate data that might be shuttled between client and server. For example if you do dotnet new blazorserver -f net6.0 you'll end up with a Blazor Server app that has a WeatherForecast.cs and related service in its Data directory
So what does "weather forecasts" really refer to?
In the webapp template; nothing - the code doesn't really do much other than display a nav menu sidebar and index page.
If you're looking to get into web dev you might want to skip the ASP.NET webapp one, because it's fairly old tech now. The modern web development trend is for a javascript application that runs in the browser, fetches small amounts of data from a back end API and manipulates the active html document to make it look like things are happening, rather than sending massive blocks of HTML between server and client and having the browser replace the active page with another one (which is what this one does).
If javascript doesn't float your boat, take a look at Blazor; it effectively works like the javascript-plus-light-communication-with-backend I mentioned, but it lets you write all your page changes with C# alone. In a Blazor server app the server maintains knowledge of the HTML the client needs and sends small chunks of it which are patched into the active document. In a Blazor Web App a small .net runtime is sent to the client so the C# runs in the browser and formulates the HTML that is patched into the document the user sees
Are there any way to do a project using pwa concept in ASPX page? I am using HTML with PWA, it was working fine but I moved into the ASP .NET. It doesn't work anymore and the JSON file is not loaded.
You will maybe found this SO post useful.
After testing, i was successful at implementing the functionality by
adding the serviceworker and manifest to a ASP.NET MVC application.
Since the view (HTML) gets rendered in the backend, it's only possible
to cache an static version of your web application. So preferable you
should use angular etc to generate your HTML.
A progressive web app works on IIS and apache web server.
progressive web app is a general concept. It has nothing to do with your web server. Please give more details about your code architecture etc
you can also use swtoolbox plugin for handing client side caching
mybe your problem is client-side caching. however PWA concepts are as follows, neither of them has nothing to do with web server type
Progressive - Works for every user regardless of their browser
Responsive - The app works on any form factor whether it's desktop, mobile, or tablet.
Connectivity-independent - Allows the user to use the web app even if it's offline.
Native Look-and-feel - Acts and feels like a native application, but is strictly web-based.
Safe - Always served up to the client through HTTPS.
Discoverable - Even though it's an "application," it can be indexed into a search engine.
Re-engageable - Allows re-engagement through features like push notifications.
Zero-Deploy hassle - Allows users to add the web app onto their home screen without the issues with app stores.
Link-friendly - Allows you to reshare using a Url.
Yes finally I able to accomplish this. PWA now works not only on ASP.NET webform but On any framework.
https://github.com/cpbenipal/PWA_Aspx
following my previous post about my game server, I've decided that I want to create a web-based server, and not a WPF one.
Currently, the server is a console application. I run the server, it has a TcpListener, and I interact with TcpClients, and the only real console-y thing I have, is a bunch of Console.WriteLines that I intend to get rid of. The server itself is part of a class library, which contains all the server logic, so that it'll be easy to wrap it in whatever platform I need.
Say I have a library with all my server-side logic, and I want the GUI of the server to be a web client, while still having a server that runs in the background and keeps the game running - How do I do that with ASP.NET?
Since all my code is C#, it's natural that I would pick ASP.NET, and use MVC with Razor, allowing me to use my original classes as data in the website.
I can handle the website part of the ASP.NET, but what I need advice with is how I create a server that acts like my previous one (runs in the background, has some sort of GUI, for input, commands and etc), and also has a website as the GUI.
Thanks in advance!
for reference, all my ConsoleApplication code is here, showing just how little the platform that runs the server has to do.
And regardless, this is the link to my game code, if anyone is interested. I'm always interested in opinions and constructive criticism!
This is an article about self hosting webapi and static files in a console application using Owin, no support for MVC. Asp.Net Core has a similar work flow (though it's not called Owin anymore), and MVC is available. Asp.Net Core apps are actually self hosted in a console application using Kestrel. When you host asp.net core in IIS all IIS does is act as a proxy.
I have a small question which ends in a big topic.
Is it possible - and yes how - to use C# code in a SharePoint 2013 Hosted App?
I tried to have a .asmx file within my project.
Then I get this error.
#"Error 1
CorrelationId: 9c1ea930-a131-4f5b-bff5-8a1a61fe34d9
ErrorDetail: There was a problem with activating the app web definition.
ErrorType: App
ErrorTypeName: App Related
ExceptionMessage: Microsoft.SharePoint.SPException: Exception from HRESULT: 0x81070964 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x81070964
And then I tried a few tutorials like...
http://chuvash.eu/2012/02/13/custom-httphandler-in-sharepoint-for-getting-dynamic-javascript-code/
http://blogs.msdn.com/b/kaevans/archive/2010/08/04/deploying-an-asp-net-httphandler-to-sharepoint-2010.aspx
http://social.technet.microsoft.com/wiki/contents/articles/24194.sharepoint-2013-create-a-custom-wcf-rest-service-hosted-in-sharepoint-and-deployed-in-a-wsp.aspx
But sometimes I didn't understand correctly or sometime I have other problems during compile everything.
I had a problem with getting assembly id/name, too. Because there was no compiled DDL File for the project.
What I want in general?
A .app file with a SP Hosted App (for SP 2013) which includes a web service for SP Client Object Model.
So I thinking about using the "default.aspx" with CodeBehind. So I could execute scripts "behind" the aspx. But then it couldn't find the assembly... Or there was something else.
Could anyone help me? If you have some ideas you could !please! provide them to me. Thank's!
SharePoint hosted Apps doesn't allow server side code to be excuted on the server, this is the whole idea of SharePoint Apps, nothing should be executed in the SharePoint Front End Servers. Unlike Farm solutions, SharePoint Hosted Apps runs on the client and can only access SharePoint resources through a predefined set of services that can be called either using REST or JSOM.
If you need a custom code, you can create a WCF service, deploy it under ISAPI and call it from your App, but this will not be doable in SharePoint online.
As for your question, you can use ASPX pages of course, but you will never put a code behind for it, as these pages are stored in a Pages Library and by design, it is stored in the content DB, so any code execution is denied.
Only aspx pages that are stored on hard disk like the _layouts pages can have a code behind.
SharePoint App runs in client context. You can create SharePoint App just using JS, HTML, CSS, JSOM. You cannot use C# for App (excluding CSOM, you can use it for creation remote event receiver for example)
If you need to implement some functionality to on-premise version of SharePoint, use traditional server-side solutions, not App.
It's important to understand the difference between SharePoint-hosted Apps and Provider-hosted Apps:
SharePoint-hosted Apps
SharePoint-hosted apps, or apps where all components are hosted on either an on-premises or Office 365 SharePoint farm. SharePoint-hosted apps are installed on a SharePoint 2013 website, called the host web. They have their resources hosted on an isolated subsite of a host web, called the app web. The App is created using HTML/JavaScript with CSOM or REST calls
Provider hosted apps
Provider-hosted apps for SharePoint include components that are deployed and hosted outside the SharePoint farm. They are installed to the host web, but their remote components are hosted on another server. The App run in a server that is external to SharePoint's. It has its own infrastructure and the Provider is responsible for keeping it running. They allow you to use Server Side code and uses the .NET CSOM.
This image will give you an overview of different Hosting solutions:
Visit the following link for more information:
https://msdn.microsoft.com/en-us/library/office/fp179887(v=office.15).aspx
The SharePoint Add-in model uses ASPX pages, which can also include ASPX controls. However any methods called are restricted to client-side scripting - i.e. JavaScript and SharePoint's JSOM (JavaScript Object Model), which is a subset of the Client Side Object Model.
I've created a Hello World WCF service that uses the ASP.NET Development Server - I launch the client which opens a page in my web browser, HelloWorldService.svc, then this triggers the command prompt to open and print out a Hello World message.
I don't fully understand this chain of action or how it's useful.
I'm trying to create a WCF service that acts as a server that allows users to connect to the server and perform a file upload - I will take this file and store it locally on my machine.
For now, allowing this to work locally on only my PC is fine but I really don't know where to begin to accomplish this. Any advice would be appreciated.
EDIT: I NEED to use WCF. So please don't suggest alternative solutions.
WCF is arguably overkill. Simplest case, just use the standrad .Net FileUpload control.
Here are some examples:
ASP.NET File Upload
http://asp.net-tutorials.com/controls/file-upload-control/
Which leads to the question "When should I use WCF"? Here are a couple of answers:
When & where I should use WCF
http://forums.asp.net/t/1480028.aspx
http://msdn.microsoft.com/en-us/library/cc512038.aspx
http://forums.asp.net/t/1478962.aspx
Finally, here are a couple of links that describe WCF-based file transfer services:
http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP
http://code.msdn.microsoft.com/windowsdesktop/Upload-files-using-a-REST-13f16af2