Unable to debug JS file in developer tools - asp.net-mvc

I have an ASP.NET MVC application developed using knockout js and webpack.
When I run the application, then open developer tools and search for any js file, it is not showing.
When I make changes in HTML, that change is shown in the UI.
When I make changes in typescript, that change is NOT shown and throws an error.
I tried setting breakpoints and none are hit. I figured that my local ts/js files are not running and I am unable to figure where web pack is running these files.
Any pointers to how I can run my local js files?

Related

Why does my electron app display the source code in the browser window?

I made an electron app, and when it opens, it shows the actual contents of the php file (it's not just php, there's html of course). I was wondering how I can get it to display the html in the browser window and not just the source code of it.
Edit: I just fixed it by making it an html file and not a php file, but is there any way to make the electron app execute php code?
In Short. No.
Php needs a php interpreter which is part of a large number of web servers, whereas Electron is using Node.js - a server side JavaScript environment. So there is no way I know of you can execute php in Electron. (Beside bundling a complete web server like Apache inside your Application, but that would take a lot of effort)

Using pub serve with ASP.NET Core backend

I'm using Dart to build JS applications that are loaded on web pages hosted from an ASP.NET Core application, and I'm trying to establish a development workflow with either pub serve or potentially pub build that allows for debugging. I've seen some related posts, but I'm still stuck. This is what I've tried:
I used pub build with dart2js and the --mode=debug flag set to generate dart sources and a sourceMap, and then used Chrome to load and debug the web pages. The problem here, apart from long compile times, is the sourceMaps don't seem to work well for the debugging. Lines in the .dart files are often unavailable for debugging, and stepping over function calls doesn't work well, instead diving into framework code. I'm also unable to see values reported reliably.
I used pub get with the --packages-dir flag to copy in dependencies and then loaded the web pages with Dartium hosted by the IIS Express server. This loads pages fine and lets me develop, but I was unable to get breakpoints working at all in Dartium unless I used the debugger() statement directly in my code. I'm also concerned about this approach in general because Dartium is no longer being updated and the Dart team's plan is to move away from it.
As an offshoot of #2, I also tried simply changing my script tag URLs in my ASP.NET pages to point to the resources on the pub serve dev server. This is blocked because pub serve apparently only serves on http, and the ASP.NET application is hosted via HTTPS locally. I tried to change the backend to load on HTTP, but now I'm running into issues with authentication/authorization not working in my .NET app. Also, I had hoped to be able to use dartdevc with this approach, but that gave me 404 errors with requirejs, I think because it was trying to load it from the IIS Express server instead of pub serve (I'm really not sure about that).
I've found some mentions in other StackOverflow posts of setting up some sort of proxying behavior in order to have a backend server request resources from pub serve, but I have no idea how this might be done or if it applies to this situation. I can't find any information.
What strategies are people using for this, and is there a best-practice in mind going forward with Dart 2.0 and dartdevc?

Swashbuckle won't load resources

I have a .NET MVC application that includes a web service.
I have added Swashbuckle to the web service project and on my local machine everything works fine.
When I move the code to our TEST environment I begin to get 404 errors randomly for the various javascript and CSS libraries.
Sometimes the swagger/ui/index page itself throws a 404. Sometimes everything loads.
I've thought about downloading all of these files and placing them in my project for Swagger to use, but based on what I've read, and the way my local environment works, it doesn't seem like that's the way swashbuckle is designed to work, so I'm at a loss.
I have very limited access to the TEST environment so any server configuration will be an issue. My hope is that swagger.config file can be updated to make everything play nice.
I discovered that my TFS build server was NOT overwriting the previous build which led to differences between my load balanced servers and files that were not being updated with changes as I tried to get Swashbuckle to work.

What is needed to open up an MVC project on a remote server?

I'm new to web development so please be kind. Anyway, I'm writing a web page in visual web developer 2012 and have hit a roadblock. I've got lots more experience with writing console applications. When writing one of those and you build the application, the bin folder is populated with the files that are required to run the application, most notable the .exe . But when I build the page all I get is .cshtml files, which when opened all it does is open the code in my web browser. I tried to get an answer on another web site but all that i got was "open it up on a web server". That doesn't make any sense to me. Please help.....
You open the project locally on your workstation, as you would any other project. But when you're ready to publish the project you would send it to a web server.
Visual Web Developer (being akin to Visual Studio, no?) should have a small built-in web server of some sort which it uses when you execute your project in debug mode. (There are more details than that, but that statement alone should be true enough to get you debugging.) That's fine for ongoing development work, but not for the resulting production application.
Analogous to installing a console application on a target workstation, you would need to publish your web application to a web server. This server may coincidentally by the same workstation on which you develop the code, but that's not a requirement.
A "web server" in this case can be one of many things. Your computer (running IIS, most likely), a server hosted somewhere, a service in the cloud, etc. And "publishing" could mean any number of things as well. Uploading the files, using built-in publishing tools in the IDE, even just committing the files to source control and allowing an automated publish service to fetch them (I do this a lot in Azure web sites).
Ultimately, the way you execute a web application that's been published isn't by double-clicking on a file anywhere. The .cshtml files, as well as any other needed files (binaries, config files, images, style sheets, etc.) are stored on a web server somewhere and you would "run" the application by making a request to that web server, which takes the form of browsing to a URL in your web browser.

ReactJS.net on Azure

I'm hoping I'm able to get some help out there with people with more experience on ReactJS than me. I'm using MVC 5 with ReactJS (using ReactJS.net to take care of the translation from JSX to js) and I was able to some stuff done that works pretty well. Testing the my code on my local pc works fine for debugging, but once I publish it to Azure for testing I get this error:
GET http://mywebsite.azurewebsites.net/Scripts/jsx/FriendSelect.jsx?_=1429662139230 404 (Not Found)
This is usually the error I get when the jsx file doesn't get converted to js successfully. Does anyone know the steps I need to take to get ReactJS.net to work properly on Azure?
I don't understand why you need to use anything react.net etc...? React comes with a JSXTransformer file which transforms your JSX to JS while you're in the process of developing your site. Compiled and minified JS code should be used in production once you no longer need JSX. Tools like Gulp can assist with automatically minifying your code for you.
Whether the site is Azure, Linux Ubuntu or anything else it shouldn't matter.

Resources