Unable to access WebService - c#

I have a webservice # http://recpushdata.cyndigo.com/Jobs.asmx but I'm not able to access it though I am adding it as a WebReference properly.
Any Help would be great.

AFAI can see, the asmx page has server errors, so you will not be able to access it.
Contact the admin of the web service to fix the errors.

Do you mean you are getting the "The test form is only available for requests from the local machine." error when accessing a method?
If so, you need to add the following into your <system.web> part of your web.config
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
This enables you to access the method from the local machine

Related

ChartImageHandler and web farm environment getting 404 error

I am using asp.net ChartImageHandler to generate charts in my .aspx pages, Everything was working great until we tested application on a web farm environment.
The problem is that for some requests, Chart returns 404 error and cannot find the image, This is the config that we use:
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;deleteAfterServicing=false;" />
</appSettings>
I guess that it is because the chart is stored in one server and not stored in the other server.
I have this section in my web.config file:
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3986ad364e35" />
ChartImageHandler is present in the handler mapping of site created in IIS.
As said in documentation page in here, What I understand is that for web farm environment, we should set the storage to file and the other two options are not applicable to web farm environment.
the dir path should be a network path and I tried this network path but it didn't work either ! here what the config look like with the network directory:
And also the network address \\serverIp\TempImageFiles is accessible from windows explorer.
Any suggestion for making this work is much appreciated !
Edit: We changed the affinity of load balancer and everything worked fine.

App Settings from Web.config in WCF Service returning null

I am having an issue retrieving app settings from my web.config file in a WCF service I am creating. When calling my settings, I am retrieving a null value. Digging into the object also shows that there are no keys in AppSettings list.
This issue has a few posts around SO/Google, and I have incorporated all the suggestions, but to no avail. Here is my current position and what I have tried:
web.config:
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<!-- CRM Creds -->
<add key="CrmUrl" value="[removed]"/>
<add key="CrmUser" value="[removed]"/>
<add key="CrmPass" value="[removed]"/>
</appSettings>...
Methods of calling the settings:
System.Web.Configuration.WebConfigurationManager.AppSettings["CrmUrl"]
System.Configuration.ConfigurationManager.AppSettings["CrmUrl"]
The file I am calling from is within a folder, whereas web.config is in the root. I understand WebConfigurationManager could find this regardless, but I am having no luck.
Code:
%projectfolder%/Client/Client.cs
Config: %projectfolder%/web.config
I have run out of things to try and have used up all my Google-fu. Any suggestions are appreciated.

Default Role Provider could not be found on IIS 7 running .NET 4

Good morning all,
I am attempting to implement my custom membership and role providers in my web application that I have implemented under the Default Web Site in my instance of IIS 7. My web application is running under a .NET 4 application pool.
However, after setting up the corresponding web.config, I get the following error:
Parser Error Message: Default Role Provider could not be found.
I have included the following block of code in the system.web section of the corresponding web application's web.config:
<membership defaultProvider="CustomMembershipProvider" userIsOnlineTimeWindow="20">
<providers>
<clear/>
<add name="CustomMembershipProvider" type="CustomProviders.CustomMembershipProvider,
CustomProviders, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=3563615169617648" applicationName="/"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="CustomRoleProvider">
<providers>
<clear/>
<add name="CustomRoleProvider" type="CustomProviders.CustomRoleProvider,
CustomProviders, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=3563615169617648" applicationName="/"/>
</providers>
</roleManager>
Now I have seen all sorts of explanations as to how solve the error that I mentioned earlier. Most of them seem to suggest that I add tags to my provider blocks.
Some seem to suggest that I remove the role manager from the machine.config. And some still seem to suggest not removing or adding anything. This last approach does not seem to account that my web application is being run from IIS and not a local machine.
In the end, I have have tried these approaches to little avail. Can someone please explain to me how I can get passed this error? Thanks in advance!
I got this error when using the default MVC 4 web application.
I had to add the following to web.config and the error went away.
Under <system.webServer>
add
<modules>
<remove name="RoleManager"/>
</modules>
Two things:
enabled="false" should probably be enabled="true"
And I'm not convinced the applicationName="/" is helpful, but it may not be hurting, either.
I got this error message when adding an application in IIS 8 to our existing web site (Right-click on the website in IIS, select "Add Application"). The application's web.config only had the default tag, which was removing the default provider that the web site's web.config defined.
I removed the RoleManager tags completely from the application's web.config, and then the website and application started working properly.

Can't access /elmah on production server with Elmah MVC?

I installed the elmah.mvc nuget package and kept the default configuration of that sans setting up sending an email and plugging it into a SQL database.
On my local machine when I use the Visual Studio host, I can open my app and access /elmah fine to see a report of the errors. However, when I try and access /elmah on production, I get two errors, first I get a 403 access is denied server error. Then in my email (from elmah) I get:
System.Web.HttpException: Server cannot set status after HTTP headers have been sent.
Anyone know what is going on here and how to fix? Thanks.
I tried the following so far as suggested by the answers below:
In <system.webServer>
<handlers>
<add name="elmah" verb="GET" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
</handlers>
And in <system.web>
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
I tried setting the path to both elmah.axd and simply ~/elmah. All still give the same error, and still works locally, but not in production.
Edit: It actually also works when I remote into the server and access it via browser on there (not using localhost, but the actual site address). So what permission am I not having? Seems like it's at the server level.
You need to enable Elmah for remote access by adding the following configuration setting to the <elmah> section in your web.config file. The default setting for this value is false, which only allows localhost, hence why it is working on your local machine from within Visual Studio.
<elmah>
<security allowRemoteAccess="true"/>
</elmah>
I always seem to forget this myself and spend a few minutes scratching my head ;)
Make sure you HttpHandler is defined in the webServer section in your web.config file.
<system.webServer>
<httpHandlers>
<add name="elmah" verb="GET" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
</httpHandlers>
</system.webServer>

Setting default at some port be some specific web service

currently I am running my web service from following path
http://localhost:16022/MachineService.asmx
and usage of some web method like
http://localhost:16022/MachineService.asmx?op=GetData1
I want to do it in following way
to run the web service from following path
http://localhost:16022/
and usage of some web method like
http://localhost:16022?op=GetData1
Is it possible to set it be the default ?
I am using VS2010.
Also possible to do so at the IIS7 itself ?
You can set the defaultDocument Element in your web.config file so you won't have to specify MachineService.asmx with each and every call.
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="MachineService.asmx" />
</files>
</defaultDocument>
</system.webServer>
Instead of manually modifying web.config you can configure the default document in Internet Information Services (IIS) Manager.

Categories