Giter VIP home page Giter VIP logo

samples's Introduction

Samples

Samples for ASP.NET and ASP.NET Core.

ASP.NET samples are under the samples/aspnet directory.

ASP.NET Core samples are under the samples/aspnetcore directory.

samples's People

Contributors

captainsafia avatar conficient avatar danroth27 avatar dependabot[bot] avatar eilon avatar floreseken avatar isaacrlevin avatar jamesnk avatar javiercn avatar lothrop avatar mackinnonbuck avatar mkartakmsft avatar nzcoward avatar paulcociuba avatar pranavkm avatar rene-sackers avatar rynowak avatar stevesandersonms avatar tanayparikh avatar terrajobst avatar wtgodbe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samples's Issues

Switching this app to server-side hosting results in blank screen

Trying to convert this app from client-side to server-side. I believe I have everything changed over

  • Index.html in /wwwroot using _framework/blazor.server.js instead of blazor.webassembly.js
  • Server project, in Startup.cs, change ConfigureServices and Configure to use AddServerSideBlazor

Solution code builds fine, but when browser loads, I just get a blank screen with no errors in the dev console.
Might be related to the issue mentioned here, but not sure
https://blog.jonblankenship.com/2018/11/02/experiences-converting-from-client-side-to-server-side-blazor/

What can I check?

I have several .net core sdk's installed
.NET Core SDKs installed:
1.0.4 [C:\Program Files\dotnet\sdk]
1.1.0 [C:\Program Files\dotnet\sdk]
2.0.2 [C:\Program Files\dotnet\sdk]
2.1.2 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.103 [C:\Program Files\dotnet\sdk]
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.300 [C:\Program Files\dotnet\sdk]
2.1.403 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.2.100 [C:\Program Files\dotnet\sdk]

Fails on docker over Https

when i run your sample on docker , the page fails to load with security warning.
Secure Connection Failed

An error occurred during a connection to parveen.local:7081. PR_END_OF_FILE_ERROR

The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.

Learn more…
Any tip will be appreciated.

Getting error : rzc generate exited with code 1.

------ Rebuild All started: Project: FlightFinder.Client, Configuration: Debug Any CPU ------
microsoft.aspnetcore.blazor.build\0.6.0\targets\RazorCompilation.targets(184,5): error : rzc generate exited with code 1.

On VS2019

Please make clear on the landing page which type of blazor sample this is

Is it a standalone client-side app or full-stack ASP.NET Core app?

If trying to learn/build a specific one of the above, I have no idea (at all never having seen blazor) if what I'm seeing is something to learn from for my use case, or if it will mislead and confuse me because it is the wrong type of blazor sample. If it has both, that further muddies learning.

Blazor Sample Doesn't Compile

image

Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'Main' could not be found (are you missing a using directive or an assembly reference?) FlightFinder.Client C:\Code\samples\samples\aspnetcore\blazor\FlightFinder\FlightFinder.Client\Startup.cs 16 Active
Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. FlightFinder.Server C:\Program Files\dotnet\sdk\2.1.508\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 137

The class Main is missing.

RenderViewToString HostBuilder setup

I am trying to get the renderviewtostring sample working in DotNet Core 3.1 in a console application i.e. running Razor standalone.

The first statement in Main gives
'HostBuilder' does not contain a definition for 'ConfigureWebHost' ...

What is the correct setup for this sample in DotNet Core 3.1 ?

Thanks

Give a little better WebSocketSample

The Web Socket sample is very contrived. using statements which shorten long delegates which use tuples and everything works in a weird async task of an echo server....

I've been trying to figure out how to write a simple web socket server to send events (ie - not respond to messages but send events from my self hosted owin console app) but this sample is just not good.

Please could you guys write a better one? Maybe properly structured which use properly named classes and methods (please no usings shortcuts or tuples) and maybe give some more info on how to do things like respond to a websocket message (in this current sample) but also how to do broadcasts and such... πŸ™

Oh and please don't tell me to use SignalR - I know I can but I just want websockets and signalr does not do "just websockets" well...

WebApi/BasicAuthentication Sample Database.

In the aspnet\WebApi\BasicAuthentication project the web.config file references a local DB

aspnet-BasicAuthentication-20131121044235.mdf

It's not in the App_Data folder, or anywhere I've been able to find. I didn't notice any documentation for manually creating it.

Can someone tell me where it is, or where the schema is so I can create it?

Refactor Scss

@SteveSandersonMS I started refactoring the Scss files in the FlightFinder project.

Currently the FlightFinder app can be themed by changing a single variable. Also, I've switched to Bootstrap 4 Scss. The variables are now mapped to Bootstrap as well, so one change updates all UI components being used in FlightFInder including Bootstrap.

How to deploy Flight Finder-demo?

The blazor Flight Finder demo is a solution with three projects, FlightFinder.Server, FlightFinder.Client and FlightFinder.Shared. In visual studio 2019 I can run it without problems. However, when I deploy it to an IIS, it deploys without error, but when called stays in the "Loading..." screen forever.

I can't figure out, how to deploy this correctly. Should I just deploy the server-project? Seems not to work. Should I deploy both projects, client and server, to separate paths? Then where do I inform the client about the server location?

Please include deployment instructions.

JS component generation for a custom DLL

I am looking at the JS component generation example at:
https://github.com/aspnet/samples/tree/main/samples/aspnetcore/blazor/JSComponentGeneration

and would like to run the tasks for an external DLL that contains blazor components.

@MackinnonBuck

  1. Can you add some insights how to do that? Adding some details how to do it for the BlazorAppGeneratingJSComponents project and re-generating the Counter component will also be helpful. Still, my main scenario is to run the generator over a custom set of UI components and see which of them are "generatable" and potentially update the generator when necessary.

@SteveSandersonMS
2. Looking at the custom elements sample Can you add some details if the following statement for child content:
https://github.com/dotnet/AspNetCore.Docs/blob/5417884bf9f97ce9724092a7e2836ccff2662a82/aspnetcore/blazor/components/prerendering-and-integration.md#dynamically-add-root-components

[!NOTE] Rendering child content of a dynamically-rendered component isn't supported.

is a current limitation and whether it can be supported in the future? The official docs does not have this section, but most of the components in my 3rd party library have child components in their definition, so as far as I understand it, they cannot be used in custom elements/angular/react/etc scenarios, e.g:

<BlazorComponent>
    <ChildComponent1></ChildComponent1>
</BlazorComponent

Unhandled Rejection (Error): Dynamic root components have not been enabled in this application.

Reproduce on MacOS

cd samples/aspnetcore/blazor/JSComponentGeneration/JSComponentGeneration.Build
dotnet build
cd ../BlazorAppGeneratingJSComponents
dotnet watch

From another prompt:

cd samples/aspnetcore/blazor/JSComponentGeneration/react-app-with-blazor
export NODE_OPTIONS=--openssl-legacy-provider
npm run start

Browse to http://localhost:3000 and click button Add Blazor counter.

The browser displays: Unhandled Rejection (Error): Dynamic root components have not been enabled in this application..

The offending code seems to be in react-app-with-blazor/src/blazor-react.js on line 32:

return Blazor.rootComponents.add(parentElement, `${identifier}-react`, props);

The BinarySubmit sample does not work - missing key JavaScript functions

It appears that the Binary Submit sample for Blazor is missing the JavaScript code that would make it work.

When I run it, I get the error :

Error: Microsoft.JSInterop.JSException: Could not find 'getStream' ('getStream' was undefined).
Error: Could not find 'getStream' ('getStream' was undefined).

I went ahead to create my own getStream function but then another JavaScript function, 'readBytes', used in the ChunkedStream.cs class (line 51) is missing as well.

Is there a plan to update the BinarySubmit sample?

OwinSelfhostSample as a Windows Service

I would like to run the OwinSelfhostSample project as a Windows Service.

I have successfully installed the service using the command sc create MyService binPath=....

The service fails to start and Event Viewer shows error event ID 7009 and 7000, "A timeout was reached (30000) milliseconds) while waiting for ..." and "The service did not respond to the start or control...".

Any ideas? Thanks.

/artifacts/bin/GenerateFiles/Directory.Build.Props not found

Hello everyone!

So I just downloaded the latest release and opened it in VS but I can't build the project. the Error message being the below text repeatedly(like two thousand times):

Project "F:\aspnetcore-8.0.1\artifacts\bin\GenerateFiles\Directory.Build.targets" was not imported by "F:\aspnetcore-8.0.1\Directory.Build.targets" at (176,3), due to the file not existing.

I even tried making the GenerateFiles directory and copying Directory.Build.targets from the root of the project. I know it might look dumb but I really tried, spent the whole night and day on it ^_^

Any help is really appreciated here. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.