Visual Studio unable to open port to host WCF Service - visual-studio

I created a solution VS2010 C# with the WCF service, the library to get data, the service is working fine in a console application in the solution. No problem.
I have to use it on a VS2008 project (and probably later on a VS2005) for the older projects. Then I start VS2010 I get the "WCF Test Client". At this time in the VS2008, I tried to "Add a web reference" on the local machine... no result.
Then I tried to create a console application with Vs2010 to host it, I did this :
Uri baseAddress = new Uri("http://localhost:8080/hello");
using (ServiceHost host = new ServiceHost(typeof(SecurityAccessWCF.WCFSecurityService), baseAddress))
{
// Enable metadata publishing.
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
host.Description.Behaviors.Add(smb);
host.Open();
Console.WriteLine("The service is ready at {0}", baseAddress);
Console.WriteLine("Press <Enter> to stop the service.");
Console.ReadLine();
// Close the ServiceHost.
host.Close();
}
I get an error on the Open(), I get this error "AddressAccessDeniedException - HTTP could not register URL... Your process does not have access rights" (the link provided is not clear, I'm on Win7 x64 as local admin and in a domain)

Shift + Mouse Right Click on Visual Studio shortcut and select Run as administrator
This way you should be able to host it.
Alternately, you could build the project and run the resulting console application the same way under admin account.

Thats a standard error meaning your application cant register the domain. Normally this is a problem on vista/windows 7 with security. Log in as administrator and run netsh http add urlacl url=http://+:80/Localhost user=DOMAIN\user
Here is a msdn article with more information

Related

C# Windows Service - Set service login Issue

I'm building a windows service that retrieves information about different hardware, and after that it stores the information in a database, right now that part is done and im trying to install that service in different computers, and i wanted to know if the little window that pops up during the installation, called Set Service login, is possible to set some default values in those textboxes.
Thanks in advance.
If you use the Visual Studio Installer you could try this:
View the code of the processInstaller and go into InitializeComponent() methode.
There you can set the following properties for an existing local account:
this.servicename_processInstaller.Password = "xxxxx";
this.servicename_processInstaller.Username = ".\\localServiceUserAccount";
This prevent to prompt the window.

Unable to launch IIS Express Web Server in VS 2013

I have an application in MVC 4 using VS 2013.
This is very strange,everything was working fine till last night but today morning when I started working and tried to run my application I found the following error:
Unable to launch IIS express web server.
Failed to register URL"http://localhost:62707" for site...
Access denied(0x80070005)
I searched regarding this since morning and I got solutions for this which I tried as:
I deleted IIS Express folder from my documents several times and
tried running the application by reopening it but that dint work.
I tried with changing the binding in applicationhost file from http
to https. With this the only thing that got changed is the error is
now showing:
Unable to launch IIS Express Web server.
The start URL specified is not valid.
I restarted my system many times as per some of the suggestion . Also
my browser too .
I tried ending the process for IIS Express from Task Manager.
But nothing seems to be working for me and even after trying almost all of the possibilities for hours I kind of got stuck at this point.
You can try this:
Open "Command Line Interface (CLI)" called "Command shell" with
"Win+R" write "cmd" put this command for removing the urlacl.
netsh http delete urlacl url=http://{ip_address}:{port}/
Then add the url for everyone
netsh http add urlacl url=http://{ip_address}:{port}/ user=everyone
Then close the VS and delete the IISExpress folder from Documents
path as:
%userprofile%\Documents, e.g. C:\Users\[you]\Documents\IISExpress
Re-run your application.

IIS 8 Server error 500 logs

So we decided to try out the new Windows Server 8 / IIS 8.
Running in VS-Dev server I simply catch all server errors in Application_Error() in Global.asx and log these using log4net.
Now I have 2 problems, first is the exceptions doesnt seem to be caught in Application_Error() on our deveolpment server (as the server returns a statuscode of 500 to the browser).
Second is that my log4net doesnt log anything from the Webapplication.
Its a mvc 3.0 asp.net application using razor views.
My local machine is running Windows 7 / VSUltimate 2012.
Trust-level set to Full and the IIS_IUSRS usergroup have full access to the folder where im trying to write the log-files.
What I really want is to just log the exceptions somewhere so if theres a built in way of doing this in IIS 8 please let me know. (Maybe redirect to some error controller which gets the exception as a parameter?)
Cheers Tomas
I'm having a very similar problem after upgrading to Windows Server 2012 / IIS 8.
The exceptions are being added to the Windows event log. Open Event Viewer from the start menu, expand Windows > Application on the left and look for events in the "Web Event" category.
On our server the following change fixed the problem:
In IIS Manager, go to ".NET Error Pages", then on the right choose "Edit Feature Settings..." and change Mode to either On or Remote Only.

Cant add solution to RocketSvn Repositories

I have been trying to set up RocketSVN server on win server 2008 R2 and the plug in client for Visual studio's 2010 but have been have a lot of trouble so will list what i have had issues with and what i did to get them working and where i am up to.
First I was having trouble connecting to the server through a browser which came down to the fact that i hadn't installed the Basic and windows Authentication on the server IIS features Doh! (fresh install :)) although it still didn't work until i went through the windows updates, After these steps i could connect to the Admin portal through a browser add add repositories and users yay!
Then i moved on to the Visual Studio's plugin and was having trouble being authenticated while trying to add or open a project from svn so back to Google and found a solution here http://community.axosoft.com/forums/thread/22088.aspx but was not using windows authentication which i wanted and was now getting another issue, I found that changing the binding in the IIS to HTTPS and setting a certificate let me use windows authentication and got me to the same position but now I'm stuck again....
tried to add images but wont let me Grrrr.... Edit : I can add images now :)
every time i try to add a solution i don't get a folder to save it to and the "Create Folder" button is greyed out all i get is the
Subversion Repositories
https://<server name>:8080
so am missing the svn/testrep/(testrep being my repository) folder to select and add my solution to..
I am using the repository URL found on the admin portal..
The error i get if i try and open a solution (even though i don't have any solutions in the repository i thought i might be able to browse it?) is
"server sent unexpected return value (405 not allowed) in response to propfind"
i hope some body can help me with this as I'm losing the will to live with this one :( i thinking its still a server set up issue but cant find any more info let my no if any 1 wants to see any server logs / config's / settings.
Cheers in advance

Debugging with VS other than localhost

I want to debug my application by VS but when the application should run, it should have url like: http:localtesting.com instead of localhost. I already have localtesting.com in my host file so directly putting that url in my browser opens my IIS default directory page. How can I make my VS to run on that url while debugging? Where should I put that url?
Edit:
Putting the url in custom web server textbox and running the solution I am getting :
Set it to "Use Custom Web Server" and put your URL into that box.
Edit: 'The unable to debug..' error message is probably a separate issue. Can you debug a brand new site that you can create just to test?
A few things can cause that error. For example, the URL Rewrite module: Unable to start debugging on the web server. Could not start ASP.NET debugging VS 2010, II7, Win 7 x64
As #SteveHobbs said, set it to "Use Custom Web Server and put your URL into that box. Just underneath that section, there should be another section labelled "Debuggers".
Put a tick into the checkbox next to ASP.NET and save the properties.
When you want to debug, go to the debug menu within VS and choose "Attach to Process...".
If you are using IIS, look for the process called 'w3wp.exe' and choose that. After a bit of crunching, perform whatever actions you need on your web app and you will see the debugger land on your breakpoints and so on.

Resources