I searched many examples of how to consume webservices methods with C#,
but all of them say to right click and add a service reference and type the address.
However I dont know why, but the webserver wich I am trying to connect does not work with this...
Here the address
https://bauru.sigiss.com.br/bauru/ws/sigiss_ws.php?wsdl
Can someone help me how could I interact with this specific webservice?
Using the WcfTestClient1 shows an error (that is probably the one you're running in to on an import):
Error: Cannot import wsdl:portTypeDetail: The ' ' character, hexadecimal value 0x20, cannot be included in a name.Parameter name: nameXPath to Error Source: //wsdl:definitions[#targetNamespace='urn:sigiss_ws']/wsdl:portType[#name='WebService SigISSPortType']Error: Cannot import wsdl:bindingDetail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.XPath to wsdl:portType: //wsdl:definitions[#targetNamespace='urn:sigiss_ws']/wsdl:portType[#name='WebService SigISSPortType']XPath to Error Source: //wsdl:definitions[#targetNamespace='urn:sigiss_ws']/wsdl:binding[#name='WebService SigISSBinding']Error: Cannot import wsdl:portDetail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='urn:sigiss_ws']/wsdl:binding[#name='WebService SigISSBinding']XPath to Error Source: //wsdl:definitions[#targetNamespace='urn:sigiss_ws']/wsdl:service[#name='WebService SigISS']/wsdl:port[#name='WebService SigISSPort']Warning: No code was generated.If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or servicesor because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.Warning: If you would like to generate data contracts from schemas make sure to use the /dataContractOnly option.
I don't know enough about the service, but you may take a look at Can I create an element with forward slash as part of the name and find it's probably an attribute being used to decorate a property (which has a space in it).
1 WcftestClient can usually be found in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\
If for whatever reason you can't get to it (e.g. a proxy server is used where you're working) then simply go to the WSDL in your browser, save the page as an XML file on disk, and when adding a service reference again don't put in the web URL, put the path to it on disk (e.g. C:\temp\wsdl.xml).
Finally I got someone who had the exaclty same problem as I did! He said to do the following:
For Windows Vista, Windows 7 e Server 2008:
Start>Run
Regedit
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/Schannel/Protocols
Right Click on Protocols -> New -> Key
Name: TLS 1.0
Right Click on the new key -> New -> Key
Name: Client
Select the created folder (Client), right click New -> Value DWORD
Name: Enabled
After that just add the reference to your project. To avoid happening the same in your app users, force the SSL use before instanciate the webservice:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
Related
I am implementing a COM component using .net for a few outdated components for a server migration task.
The old component was used to receive an image path on the current server, convert it to a jpeg and save the converted image in the same path.
This is trivial to do in .net, however my main problem is obtaining the server context. I am not sure how to do either one of the following:
saving the image to the same path that the original image was retrieved from
or sending the image directly to the response stream (avoiding the need to save the converted image)
The component is being called within a class ASP page (yes, unfortunately!) using:
Server.CreateObject("Component.Class")
Is there anyway in the implementing .net code that I can obtain a reference to the Server object that created the component? I was hoping that if I could obtain a reference to the server, I could then obtain the appropriate context to write back to the response stream.
I have worked this out, obtaining a few clues for the internet and google. Thought I should post this in case anyone else has the same problem.
Obtaining the server context was a matter of including the following references:
COMSVCLib (should already be in your COM section when adding references to your project)
ASPTypeLibrary: Look for: "Microsoft Active Server Pages Object Library". If you don't see this immediately in your COM section, then you will need to add this from "windows programs and features". Add the following feature: Internet Information Services -> WWW Services -> ASP
Working out the above was the hardest thing :-) After that, its very simple to reference your server and other intrinsic ASP objects:
COMSVCSLib.AppServer aspServer = new COMSVCSLib.AppServer();
COMSVCSLib.ObjectContext oc = aspServer.GetObjectContext();
ASPTypeLibrary.Server server = (ASPTypeLibrary.Server)oc["Server"];
You can do the same with with other ASP objects such as Request and Response.
I need to access a view on an oracle server with an ASP.NET website. It works if I debug the website through visual studio(press F5 in VS2012), but when I go to the version hosted on my local IIS (LocalHost/) I get this error:
Oracle.DataAccess.Client.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified
A lot of the information I'm finding is related to the deprecated System.Data.OracleClient and I'm using Oracle.DataAccess.dll File version 4.112.3.0, Assembly version 2.112.3.0.
I set the AppPool it's running in to Enable 32-Bit Application=True based on some other people with a similar issue, I think everything else is default settings.
I've tried using the gacutil to make sure it is installed in the gac.
I also made a small winForms application that works and can access the data.
I've tried a couple connection strings:
This one works:
"Data Source=SOURCE;Persist Security Info=True;Password=****;User Id=****;"
This one doesn't work, I can't figure out a valid SERVICE_NAME:
"user id=****;password=****;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=****)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=****)));"
I always get this error:
Oracle.DataAccess.Client.OracleException: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Places I've looked for SERVICE_NAME
I checked the connection I was able to establish with the first connection string and the SERVICE_NAME was either blank or sys$users depending on the query I ran.
I found three files named tnsnames.ora; one was completely blank, the SERVICE_NAME in the other two were Worker and <database service name>.
NOTE: I don't have access to the server, just credentials for this one view.
I found the SERVICE_NAME with this: select sys_context('userenv','db_name') from dual; and used the second connection string from the question:
"user id=****;password=****;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=****)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=****)));"
Thanks for all the help.
I have an EntityFramework project running off MySql that runs great locally as well as on a dedicated server, however I'm trying to move this project to HostGator and I'm receiving the following error:
Schema specified is not valid. Errors:
App_Code.WireWeld.ssdl(2,88) : error 0002: Request failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.MetadataException: Schema specified is not valid. Errors:
App_Code.WireWeld.ssdl(2,88) : error 0002: Request failed.
I know the database is correct as I can connect via Navicat and see its contents. I'm pretty sure the connection string is correct, I have the proper username and password.
I'm really stuck on this one and would appreciate any help possible.
If you are using more than one model in your project I advice you to have a look into that topic as it describes possible solutions to the problem.
If you are not using multiple models than this looks like a file permission issue to me.
Perhaps in the hosted environment, the account underwhich your application is running doesn't have access to where the metadata files are located?
You should make sure you have permission (read/write are required). If this is not an option for you than the only go would be to embed the metadata in the assembly directly and use a res:// style connection string.
If you're using SQL server and have 2 projects - one is a class library and the 2nd one uses that class library in main project, then place both dll from class library project to main project refrence.
1-EntityFramework.dll
2-EntityFramework.SqlServer.dll
I created a simple WCF service In solution and added a console application project to the solution to call the WCF service. When i debug chat solution it give me the following error. The WCF service was working fine when i tested it.
ServiceHost host = new ServiceHost(typeof(EvalService));
Resulting error:
A child element named 'service' with same key already exists at the
same configuration scope. Collection elements must be unique within
the same configuration scope (e.g. the same application.config file).
Duplicate key value: 'EvalServiceLibrary.EvalService'.
(C:\Users\User_Name\Documents\Visual Studio
2010\Projects\ChatSolution\ConsoleHost\bin\Debug\ConsoleHost.vshost.exe.Config
line 14)
I got the same error, but in my case I was creating a service using a previously used name. Sometimes, even if you delete the service file/code from the solution, its corresponding definition in the App.Config file remains un-updated.
I did a Quick Find (Ctrl+F) over the whole solution and typed the name of the service I was using. It located the piece of code in the App.Config file where the service is defined.
I deleted it and created the service using the same name.
It's all written in the exception message. You have two services in your app.config defined with the same key. Just look through the app.config in your console app, it shouldn't be hard to find.
I just got a new Windows Server 2003 machine and I've been trying to get Nerd Dinner onto it. The server already has .NET 3.5 SP1, ASP .NET MVC, etc.
When I upload Nerd Dinner via FTP to a subdirectory of the main webpage, I get a 404 when I go to any page in the site except for the root and the home page doesn't event show the map.
For example, when I go to the about page, I get the following IIS log entry:
2009-08-13 17:56:10 128.200.123.118 GET /nerddinner/Home/About - 80 - 128.200.123.89 Mozilla/4.0+(compatible;+MSIE+8.0<snip>) 404 0 3
I'm extremely puzzled because this is a freshly downloaded and compiled copy of Nerd Dinner from Codeplex.
In case it helps, here's a log entry from the failed attempts to get the JavaScript for the map (note the complete lack of "/nerddinner"):
2009-08-13 18:03:05 128.200.123.118 GET /Scripts/Map.js - 80 - 128.200.123.89 Mozilla/4.0+(compatible;+MSIE+8.0<snip>) 404 0 3
I have a strong feeling that I should be able to fix this inside the asax.cs file but I can't quite get it to work even after appending "nerddinner/" to the front.
Any ideas for what's happening?
Edit: I uploaded it to the root of the webfolder and the 404s continue.
Edit 2: Thanks for the suggestions. I followed the instructions and now I don't get 404s. However, there are 2 major problems left:
The scripts and content folders don't map correctly. I get 404s on all references to the files inside those folders.
I can't view dinners at all. I get:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
and a line in red that says "<connectionStrings configSource="ConnectionStrings.config" />". Except that ConnectionStrings.config doesn't exist on the server, so it wasn't an important file according to VS, and thus, I have no idea what the error is referring to.
(a quick search of my local hard drive turns up a ConnectionStrings.config file with nothing in it)
Edit 3:
Now I think I'm getting the equivalent of a SQL Server 404 when I go to view dinners...
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Summary To Help Others Running ASP .NET MVC on IIS6, Especially Nerd Dinner:
IIS 6 may throw piles of 404s at you because it doesn't understand that files can have no extensions. To solve that, follow the steps in Phil Haack's blog post.
ASP .NET MVC URL rewriting is not magic. It only rewrites URLs that are piped through code. References to scripts, images, databases, direct links (aka a href tags; not the ones that are dynamically generated) etc. are not remapped based on the directory of your application. For the Nerd Dinner application, go through the pages and add "/nerddinner/" in front of references to these references. Substitute "nerddinner" with the name of your subdirectory.
Take the database and attach it to SQL Server (or SQL Server Express) on your server. Add the Network User to the database with read/write roles.
Fill in the correct connection string for your setup. In my case, I was referring to the server by IP address and using SQL Server 2005 so my connection string is:
<add name="NerdDinnerConnectionString" connectionString="Data Source=128.200.123.118; Initial Catalog=NerdDinner; Integrated Security=SSPI" providerName="System.Data.SqlClient.SqlConnection"/>
Are you running it on IIS6? If you are, you will need to patch the route table to take into account the .ASPX extension, which IIS6 more or less requires.
Phil Haack has a good walkthrough that explains this process. He also explains ways you can do it without the .ASPX extension:
http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
The scripts and content folders don't
map correctly. I get 404s on all
references to the files inside those
folders.
In ASP.NET MVC files do not map one for one to an URL, like they do in ASP.NET. Instead, a match in the routing table diverts a GET or POST request from the browser to a controller method in one of your controllers. From there, the controller decides (either explicitly or by convention) which View to display.
An error occurred during the
processing of a configuration file
required to service this request.
Please review the specific error
details below and modify your
configuration file appropriately.
ConnectionStrings.config needs to exist on the server, since it is being referenced in web.config. It's an include file, so there doesn't necessarily have to be anything in it. But if it is being referenced, it needs to be included on the server, so just copy it there with your FTP program.