Visual Studio 2010, solution with a form and web service - vb.net

I have a solution with a form and web service and want to debug the web service. I've tried set the .asmx page as the start page. I guess it's more of a Visual Studio 2010 question rather than a vb question.

just type in the complete webservice url in the browser. You will be able to provide the paramets value and run the webservice.
eg of a url: localhost:53788/HelloWorld.asmx.

You're problem could be that you haven't enabled debugging in your web.config file. Your config file needs to look like this.
<configuration>
...
<system.web>
<compilation
debug="true"
...
>
...
</compilation>
</system.web>
</configuration>
See here for more information. http://msdn.microsoft.com/en-us/library/e8z01xdh%28v=vs.100%29.aspx

My issue was that my application's settings were still pointing to the production web service. I changed them to point to the local service which fixed the issue.

Related

ELMAH for ASP .NET MVC Windows Application

I need to log errors for an asp.net mvc windows application which also uses entity framework and for doing this i thought of using ELMAH.
My App.config file contains the appsettings for providing folderpath and other file related details.
Now when I try to add the configuration (elmah...../elmah) for ELMAH after installing it in my project it throws an exception "Configuration system failed to initialize".
But when I remove that code then it works fine.
Please provide me the solution to log errors for MVC windows application.
And the final question is ELMAH.mvc free to use or not?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="folderpath" value="~PA\FileImport"/
<add key="XMLFolderPath" value="~\FileImport\XML"/>
</appSettings>
<connectionStrings>
<add name="####" connectionString="############"
providerName="System.Data.EntityClient" />
</connectionStrings>
<elmah>
..........
</elmah>
</configuration>
It sounds like there's a problem with your ELMAH configuration, since ELMAH and EntityFramework normally doesn't interfere with each other. I would recommend you to follow a tutorial like this: ELMAH Tutorial. There's a ton of tutorials for ELMAH outthere, why a simple google search will find a lot of resources.
If following a tutorial doesn't work, you should probably add some additional information and web.config code in this thread, since figuring out your problem from the amount of information, is almost impossible.

Enabling Glimpse causes "Page not available"

To get some diagnostics for our MVC4 application (with an WebRole for Microsoft Azure) we installed Glimpse through NuGet.
Everything went fine, but when I enable Glimpse through the ~/Glimpse.axd page our application is completely unreachable. On every request we get the message "This Webpage is not available" (Chrome).
In the output window in Visual Studio 2013 I saw an error message which suggests to disable async support through the web.config:
<appSettings>
<add key="Glimpse:DisableAsyncSupport" value="true"/>
</appSettings>
Unfortunately this is not helping. When we turn off Glimpse everything is just fine.
How can I find out what the problem is?
Update
The logs shows me this warning:
WARN | Unable to locate '</body>' with content encoding 'Unicode (UTF-8)' for request. The response may be compressed or the markup may actually be missing a '</body>' tag.
Found my solution on the troubleshooting page of Glimpse.
In short, url compression was applied so had to disable this in the web.config:
<system.webServer>
<urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="false" />
</system.webServer>

IIS WCF Service not using app.config

I have a .NET 3.5 WCF service hosted in IIS. The project service library has an app.config file with some configuration settings (Database connection strings, etc.). I deploy the project via a website project in Visual Studio, which generates a web.config to manage the endpoints. Is there a way I can put the app.config settings from my service library in to the web.config? The IIS hosted service seems to be using default values from the settings designer, and ignoring even an expliclty copied in app.config. I'm guessing this has something to do with the fact that a DLL can not utliize an app.config.
My service application is set up to pull the settings settings from the [MyAssembly].Properties.Settings.Default namespace.
Can you use external configuration files?
Your web.config:
<config>
...
<connectionStrings configSource="myConnections.config"></connectionStrings>
</config>
And then your external myConnections.config file:
<connectionStrings>
<add ... />
</connectionStrings>
You can have multiple external configuration files referenced from your main web.config file. See see this blog post for a nice explanation of how/why to do this.
I hope this helps!

HTTP handlers in IIS6 or IIS7 classic mode

I'm currently struggling with httphandlers in IIS.
I'm developing a website in .NET4 in VS2010 and Cassini. In this website, i have a gallery, whose pictures are loaded through my handler.
For example http://mywebsite.com/Gallery/123/Pic1.jpg
My HTTP Handler gets the id 123 and returns the picture from the database (simplified).
So, everything works fine in Cassini (VS integrated webserver) and in IIS7 in "integrated mode". Pictures are loaded like they should.
But I have to deploy this site on a shared hoster, who is using IIS6.
After many searching and own logging, I found out, the the request isn't routed to my handler, and so I get a 404 from IIS.
My definition which is enough for IIS7 integrated mode:
<system.web>
<handlers>
<add verb="*" path="Gallery/*/*" type="[coorect Type spec]" />
</handlers>
</system.web>
For IIS7 in classic mode I had to add
<system.webServer>
<handlers>
<add name="ImageHandler" verb="*" path="Galler</*/*" type="[type]" modules="IsapiModule" scriptProcessor="c:\windows\Microsoft.net\framework\v4.0.30319\aspnet_isapi.dll"/>
</handlers
</system.webServer>
This last config only works whith the stuff in the module and scriptprocessor attributes...
But this config doesn't work in IIS6....
Can anyone help me ?
The issue is that IIS6 typically decides what ISAPI handler to pass the request to by using the file extension. So it sees .jpg and tries to serve a static file from that path. This is also what IIS7 refers to as classic mode. And you'll note you are referencing aspnet_isapi.dll in your configuration because it needs to be told what should handle this. Once you've passed it into aspnet_isapi, the asp.net http handling pipeline kicks in and you can execute your handler.
The easiest fix would be to find a host that supports IIS7. Failing that, you could see if they have any url rewriting options. With that, you could rewrite things so that you append an .ashx on the url, which will let IIS6 grab it and put it into the asp.net pipeline and your handler would fire. You could also see if they allow wildcard mappings, but that is a very tall order for most shared hosts.

Unable to automatically step into the server. The remote procedure could not be debugged

I am having a problem stepping into code which is a website hosted on IIS7.
Basically I have a test class which calls a WCF service like so
ISecurityService service = new SecurityServiceClient();
MembershipUser membershipUser = null;
membershipUser = service.GetMembershipUser("Mark"); // THIS LINE FAILS!!!
I get the following error but I have everything enabled as far as I know, i.e.
<compilation debug="true" targetFramework="4.0" />
Here is the error msg, I would appreciated any feedback. If I don't try and step into the line above then all works ok.
Microsoft Visual Studio
Unable to automatically step into the server. The remote procedure could not be debugged. This usually indicates that debugging has not been enabled on the server. See help for more information.
dont forget to set compilation debug="true" in your wcf service web.config file.
are you using vista by any chance?
anyways, take a look at this post:
http://mvolo.com/blogs/serverside/archive/2006/12/28/Fix-problems-with-Visual-Studio-F5-debugging-of-ASP.NET-applications-on-IIS7-Vista.aspx
hope it helps
EDIT: have a look here as well
Return MembershipUser using WCF service
You can also try turning on anonymous authentication in IIS. That worked for me when I encountered this issue.
I've had the same error. The problem was that the WCF web service's site on IIS was stopped, because another process was occupying the same port!
To discover what process is, from the command prompt:
netstat -aon | find ":your_iis_web_services_port_number"
Hope this help you.
dont forget to set compilation debug="true" in your wcf service web.config file.
If your startup project different from the WCF Service that is in question and you have start wcf service host when debugging another project in the same solution checked, you will need to set compilation debug="true" in that projects App.config.