Host and Debug Silverlight application through IIS - c#

I've been new to silverlight applications and trying to figure out this issue for past few days.
I tried creation a silverlight application in VS 2012, there are two separate projects created,
With Xaml files where the actual content exists
The .Web project where the .xap file is created.
When I tried running this through VS with breakpoints in the first project through IE the breakpoints were connected quite well.
When I tried hosting this project on IIS and tried running it on IE, it worked. (I hosted the .Web project only)
While I tried browsing the silverlight app from IIS and attached the process to IE with type silverlight,x86 in VS with those breakpoints in project 1, I was unable to hit them.
Please help me to debug my silverlight app when I try to browse it from IIS.
I tried everything I could think of so far. A hint would really be helpful.
Thank you.

Phew, finally this is fixed. Everything was precisely as it was supposed to be, I just missed out on the flow that was necessary. Below is the approach to debug silverlight app through IIS
Create a new silverlight app in vs
build it and create a new website in iis
in website add the silverlight.web project
add breakpoints in silverlight app from the same path as hosted in iis
browse the aspx page of .web from iis
click on attach to process (while the aspx page in running in IE) and search for iexplorer with type silverlight,x86 and click attach. (Make sure you're running VS in admin mode).
Refresh the IE page, and voila you have what you want.

Related

Asp web page isn't loading from IIS

So I am very new to web hosting. I am simply trying to host my asp website locally, but when I try browsing through IIS it just loads and never shows anything.
Here it is in the directory:
And here it is in IIS:
Then I just started the application pool and then clicked browse. Am I not doing something right?
You need to use a browser to view your website locally. Not the file explorer.
You can try localhost as url first, if that does not show your site follow the steps below.
Open the hosts file, located in C:\Windows\System32\drivers\etc
(it could be read only so you may need to change that attribute)
Add a line to this file, eg 127.0.0.1 www.medwebtest.com and save
Right click medwebtest your website in IIS left pane and select
edit bindings
Add the url www.medwebtest.com to the site as a new binding.
Reopen the browser and navigate to your new url.
So the solution I ended up going with was installing UltiDev and running my webpage from that. Honestly it felt far easier to use. I just installed it and selected my files and it worked. I was hoping that's how IIS would work but it still kept throwing errors for me.
I had a similar issue, on my new installation of windows.
turns out that I have not installed features for IIS using the following screen
Once the features have been installed, the website started working again.

Why is MVC Web Api only reachable when started in debug mode?

I am facing a strange problem on both my laptop and desktop computer.
In my solution I have an MVC 4 Web Api and the solution is started by Visual Studio 2013.
So If set the Web API project as startup project then When I type some url of the web api it hits the controller.
But if the startup folder is another project, like a website that consumes this web api, then the web api is just unreachable.
I even tried to hit the same url that works when web api is started in debug mode.
So, what could be wrong?
Most likely the issue is that web server is not running. Try hosting your web API in IIS with a fixed URL and port.
Or your try setting multiple start up projects like this:
In your Solution Explorer,
Select, Right click your solution.
On the Project menu, click Properties. The Solution Property Pages dialog box opens.
click Startup Project.
Click Multiple Startup Projects and set the project actions start.
Two possible ideas to try:
Left click on the WebApi project, and open the properties window (F4 for shortcut key) ensure Always Start When Debugging is set to true
When debugging your consumer application, right click on the WebApi Project, and click Debug > Start New Instance
If they don't work the best solution would be to host the WebApi application using IIS / IISExpress
I have found the actual problem.
I am running Windows 7 x64 and Visual Studio 2013.
I had to uncheck the Enable Edit and Continue checkbox under Tools->Options->Debugging.
Now I am using a single startup project in my solution and I can call the web api also when not in Debug mode.

Visual Studio 2010 Build issues

I am using visual studio 2010 on .net4.0 for my projects and I've found that each time I do a change in my project, I build and run but I cannot see my changes. I've found this happening once or twice mostly with my web service projects. I'm no pro with web services and am encountering this problem for the first time so would be grateful to anybody who can tell me what has gone wrong with my project and how to fix it.
Edit
My asmx file is where I have added an additional method but am not able to see it when I run F5
When you change the compiled code in a web service or site, you need to make sure you restart the web server hosting that service or site.
You are probably using the ASP.Net Development Server. Although Visual Studio starts this server for you, it does not restart it automatically when you rebuild. As a result, the server will still be referencing the previous version of the assembly that you changed.
In the Windows system tray you should see one or more icons depicting a web page with a purple gear overlapping it at the bottom-left.
There are three of them in this example:
You can stop the server by right-clicking its icon and selecting "Stop". (If you have more than one, you will learn to identify the one you need to stop by recognizing the port number shown in the tooltip when you hover the mouse over the icon.) Visual Studio will restart it when needed.
When you're making changes to a service or site, use this workflow:
Make code changes
Stop the ASP.Net Development Server
Rebuild the project containing the changes
Run
Client-side code vs. Server-side code
If you're changing client-side code (HTML or JavaScript), then you may need to force your web browser to refresh its cache. In Windows this is normally done by pressing CTRL+F5 in the browser (see refreshyourcache.com/en/cache for more info). If you're changing compiled code (C#), and restarting the server doesn't help, try restarting Visual Studio, then do Build -> Clean Solution, then Rebuild.
If you are facing issues in ASP.Net Development Server, I think you are better off creating a virtual directory in IIS and host your web service there. That way you should be able to make your changes, just build it (don't run it) and that should be available on your virtual directory and you just browse to webservice. Then you don't have to hit F5 again and again and don't have to worry about instances of ASP.NET dev server.
Following article contains good step-by-step instructions on how you do it on IIS 7.0. This article is about hosting a website - however, hosting a webservice is not different.
http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS-7-0

VS2008 debugs old ASP.NET web service

I'm writing an ASP.NET web service, in C#. Before yesterday if I wanted to debug it I would just press F5, and ASP.NET Development Server would start hosting my service. Breakpoints would be enabled and would work. Recently this functionality is gone. Now when I start debugging, Development Server is started but the old version of my web service is hosted, and breakpoints do not work. I get a warning that versions do not match.
It does not help if I rebuild everything, or change the assembly version, or even change the file name of the DLL. It does not help if I delete the whole temp folder %TEMP%\Temporary ASP.NET Files. Old web service will be pulled out from who knows where, and stored in temp folder again.
Major change before yesterday was that I had installed IIS. Web service that is installed there works as expected, but I need to debug it as well. I thought that the problem is that I installed the web service (with vdproj), so I uninstalled it, but this did not help either.
How to prevent the system from caching the old version of web service. Where is this old version stored anyway?
Check the Web settings on your ASP.NET project. To get back to using the ASP.NET Development Server for F5 debugging make sure the "Use Visual Studio Development Server" radio button is selected under the Server heading. I also specify a specific port so other projects in my solution can consistently reference it (in my case I'm dealing with a web service). There's a good chance that you will find the "User Local IIS Web server" radio button selected.
Hope that helps.
EDIT: The problem here is not about IIS, but about changing the target build output folder of web service. It must be bin\, or Development Server cannot find it. Rebuild did not help because it would change dll file in new folder, but old file would remain undisturbed in bin folder.

Breakpoint will not be hit in silverlight running on azure dev fabric

I'm building application using WCF RIA services and silverlight running on azure dev fabric. I have a solution with silverlight client projects, a Web client project and WCF projects. I placed breakpoints in silverlight project and WCF project (in app.xaml.cs) so I can step thru the code on both side. I break in my WCF code but I can’t jump in the silverlight code. When I looked at the silverlight breakpoint while debugging, the red dot displays an exclamation mark and this message: "The breakpoint will not currently be hit".
I’ve done several things to solve this:
Made sure that the ClientBin folder contains the correct .xap file.
The folder contains the correct xap.
Checked the solution if it was in release mode, but apparently I was
in Debug mode
Checked if silverlight debugging is enabled in web site, yes it was
enabled. I’m able to debug the silverlight running on separate
instance (not in azure).
Deleted bin/debug and or bin/obj folder but still no good
Deleted the ClientBin folder on silverlight's web role end
point
Deleted the source codes and then retrieve them again from source
control to check if there’s change in source control, still no good.
Apparently the solution in other developer’s workstation works fine, I’m
the only one having this problem.
Reset the iis using iisreset, still nothing good happened
Cleared the browser's cache (I’m using IE9), nothing good
happened.
Anyone ever met this situation? Any answer other than re-installing would be appreciated.
I tried to reproduce this case on new solution with new azure, silverlight and wcf project and everything works fine. There was no problem in debugging either silverlight or wcf project.
Thus, there is nothing wrong with my VS or browser setting.
I tried to use a copy of the other developer's solution and there's no trouble in debugging. I have no idea why such thing could happens because the solution is basically the same (All of the csproj.user and suo files are not checked in to source control.)
Go to your Solution >> Properties >> Set the silverlight project as the startup project.

Categories

Resources