Silverlight in ASP.Net MVC - Not loading text - asp.net

For some reason, the Xap file of my Silverlight project, isn't loaded in the Asp.Net MVC website.
Checked the page -> --> is ok.
Checked build -> is ok
Checked Xap file -> is there
It could be the Xap is not adjusted after modifying the Silverlight application, but i thought it was autogenerated.
Can anyone help me to fix this problem?
Edit: followup:
The Xap is in the ClientBin and referenced in the Silverlight Applications "property" (checked again to be sure).
It just won't load when i start the page, it has a black/white background (and yes, when i right-click, i can see the "Silverlight"-menu), but the element itself is not loaded :(.

I have solved it myself.
Their are some reasons.
It's not yet referenced in your project. Go the the settings for the website and select the Silverlight project.
The IIS is not yet configured to handle the different Mime-Types, you can find more information:
For IIS Express
For IIS
It should be these mime-types:
application/x-silverlight-app
application/xaml+xml
application/x-ms-xbap
4.Or the Link to the XAP File is wrong.
You can check it out with Fiddler2 (which also solved my problem).
Hoped that helped someone :)

I have to guess that you are adding your Silverlight project to an MVC website that was created separately (as MVC is not the default website type for a Silverlight project).
If that is the case, you need to go to your project settings for the website and select the Silverlight Applications tab on the left, the press Add and select your Silverlight project. By default that will also add a test page for that Silverlight app to your website (might come in handy for testing).
This creates the relationship that will copy the XAP to the ClientBin folder of the Website.

Related

Requests for .ASPX File Compilation

I've been trying to understand the different types of compilation involved in ASP.NET and have come to seek some clarification regarding dynamic compilation of .aspx files. Specifically referencing the following statement from Microsoft's Understanding ASP.NET Dynamic Compilation:
"By default, ASP.NET Web pages and code files are compiled dynamically when users first request a resource, such as an ASP.NET page (.aspx file), from a Web site."
My question is simple, yet doesn't seem to be discussed anywhere.
Is it an HTTP GET or POST request that compile .aspx page? Or does it not matter?
and
If I can see requests (both GET and POST) to the .aspx page but there is no .dll or .compiled file created, is there a problem? The content of the .aspx file is correct.
Any help in understanding this aspect of ASP.NET compilation would be greatly appreciated. Thanks!
The compile is a one time event. And it depends on what kind of project you created.
if you create a asp.net web site, then pages are compiled on the fly - but ONLY the first time they are used - use by anyone. So you don't have to care or worry about this issue. But to answer your question? They are only compiled one time. Not each time.
If you create a asp.net web site application? Then when you deploy the site, all code and pages are compiled at deploy time. No runtime compile on the fly (that one time, first time) occurs. and I belive that you can deploy without a pre-compile for a web site application - and you notice quite a delay the first time the site is used as a result. But in this case - only one .dll for the site is created. This is really simular to a desktop application. You compile the project, and you get one .exe or one .dll. You may well see/find some addtional .dll's from libraries that you referenaced in the project also included in the bin folder.
As for the .dll? As noted, it depends on the type of site you created. If you created a asp.net web site application, then everything (most) is compiled into ONE .dll that resides in the bin folder. So each compiled page thus does not have a separate .dll.
The site is thus pre-compiled (or only compiled one time). For a asp.net web site (not a web site application), then you should/would in theory see a new .dll for each web page if you created a asp.net web site in place of a asp.net web site application. Some prefer a web site, since then you can update ONE page without a whole site re-compile.
But, if you have your own IIS server, then choosing a web site application is preferred. One big difference is that you can create custom logon and authentication providers with a web site app, but you can't with a web site. You can still have and create logons for that web site, but a web site application allows you to over ride and build your own authentication providers.
You as a general rule only want to create a asp.net web site application if you have your OWN IIS server. For most hosting plans (say low cost ones), then you have to use a asp.net web site - not a asp.net web site application - and in that case, then .dll's should appear for each web page in that case.
But as noted, in either case - once the page is compiled, it does not re-compile over and over each time such pages are used.

How to Stop page autorefresh in Visual Studio 2017 ASP.NET Core project

I upload images to the server via ajax which are saved in the directory wwwroot.
After this operation page auto refreshing like "browser link".
How can I disable tracking for change in some directories in wwwroot ?
Thanks!
It seems you are talking about the Browser Link and not Browser Sync which is an extension in Visual Studio for ASP.NET projects.
Unfortunately, in either of them, there is no way you can disable it for specific directories. You can only disable them completely. Click on the link given above to learn more on that.

VS2010 - ASP.NET Configuration Won't Open

I have a standard ASP.NET project. I have created a login control on the page and now I would like to start adding the option to register as a member on my page.
My problem is that when I click "Asp.net Configuration" in the solution explorer or under the Projects tab. Nothing opens up.
I have made sure that my project is not running, the configuration window just won't open.
SOLVED! I had exactly the same problem, Firefox was my default browser, after I reset Internet Explorer as the default browser, it worked! The configuration page is (for some silly reason) a web page, and perhaps it only jives with IE.
I had the same problem, but I didn't want to keep switching from Firefox to IE to solve the issue. Digging a bit deeper, it seems the provided URL is incomplete. You need to use the following template:
http://localhost:<port>/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=<projectPath>&applicationUrl=/
Hope that helps.
First check if you have an aspnetdb.mdf under the App_Data subfolder of that you previously set up the needed tables for the application services in another database.
If you haven't got these then build the solution and navigate to the page which has the login control on it. Normally ASP.NET will generate the needed database aspnetdb.mdfin the App_Data folder. Once you have that database you should be able to use the configuration which starts a web application with which you can create your users and define the roles to which they belong.
Grz, Kris.
Sometimes, if web.config file is not opening on VS editor, ASP Configuration browser page won't appear, so make sure that web.config is open in the VS editor and then try to access the Configuration.
I was having the same issue with a brand new ASP.NET project in Visual Studio 2012.
When trying to open Project --> ASP.NET Configuration from Visual Studio, it was saying: An error was encountered. Please return to the previous page and try again.
The path to my application was: E:\\_Dev\C#\Site
I changed the Path to: E:\\_Dev\Web\Site and guess what? It works.
So even the # from C# was causing an issue. This thing is very picky on special characters...

ASP.NET Routing not firing when site is published to remote host

I have a website that was originally written in webforms to which I have added MVC functionality. When debugging locally it works fine, however, once published and uploaded to my host the routes do not work and return a 404.
I am pretty sure that I have uploaded all the correct files. Would just appear that routing is not working.
Any idea?!
(the site will still serve normal aspx pages fine)
I think the problem may be related to Mixing ASP.NET MVC into ASP.NET WebForms
But I cant see from that thread what the solution was. It looks like it might be something to do with the app_pool mode - but I am running in integrated mode, which is right AFAIK
UPDATE 2
So I think I have routing working. I basically created a new MVC app and went through theweb config file line by line and made sure I have everything I needed. Funnily, none of the tutorials online mention the correct additions you need to make. hey ho..
I have have another issue mind you...
When i load my mvc page I am greeted with the message:
The SessionStateTempDataProvider requires SessionState to be enabled.
I've added a line to web.config to enable sessions (wasn't aware they were off) and it still doesnt work.
UPDATE
I created a new asp.net MVC project and ended up going through web.config line by line and ensuring that everything that related to MVC was included in my hybrid app. Suffice to say that none of the guides mention all the settings that are required (i was using the book professional asp.net mvc 1.0). I then included the global.asax file which is not published and set up a route so that a request for / was not being caught by MVC. I also had to enable sessions in web.config.
And now it works!
Should I mark this question as the answer...not sure on the protocol here :)
I was going through the same thing because I deploy with compiled views. I don't know why but global.asax isn't included in the Release folder that I uploaded. I just figured it was compiled into one of the DLLs. I was getting 404 for everything so I tried uploading global.asax and the site came to life.

How to run/debug multiple web application projects with-in the same solution?

I have 2 web application projects. One is my asp.net MVC app and the other is for the admin related functions which is asp.net web forms Dynamic Data. My MVC app would be the main site, but I would want the webforms to work under an Admin folder of the MVC site.
While debugging the application, I would like the "/admin/Default.aspx" link on the MVC site to link to the default page within my Dynamic Data site. How do I accomplish this? I know I can test each project independently.
Within the visual studio project, you can right click on a folder and select "Convert to Web Application" which resolved my issue.
The easiest way would be to run them both in separate virtual directories and use Url Rewriting to push requests for the root to the public site. You can nest ASP.NET applications, but that generally requires quite a bit of fussing with the configuration file to dodge inheritance issues.
You could achieve this behavior via your IIS-Manager. Click on the Website, navigate to the folder you want to behave like a separate application and use right-mouse click and press "convert-to-application".

Resources