2016-12-22 7 views
1

RESTFulサービスを開発しましたが、ドットが入ったパラメータを渡すときに問題が発生しています。 %2Eでドットを置き換えてURLをエンコードしようとしましたが、終点が見つかりませんでした。ドットを削除すると、終点が見つかるので、ドットに何か問題があることは明らかです。"ドット"が入ったパラメータでRESTFul Webサービスを呼び出す方法

http://localhost:9999/SvcLipigas.svc/AlmacenaPedido/229188562/16122016/2030/123456/CILINDRO%2015%20KGCODIGAS/2/14000/15/19122016/1514/19122016/1000

しかし、この他の一つはしません:

例えば、この要求は動作します

http://localhost:9999/SvcLipigas.svc/AlmacenaPedido/229188562/16122016/2030/123456/CILINDRO%2015%20KG%2ECODIGAS/2/14000/15/19122016/1514/19122016/1000

お知らせ "CILINDRO%の2015パーセント20KGの%の2ECODIGAS" のドットパラメータ。

ご協力いただければ幸いです。

現在、パッチとして、パイプ文字に置き換えられた点を送信しています。サービスでは、これをドットに置き換えていますが、これは非常に醜い解決策です。

EDIT:

[OperationContract] 
[WebInvoke(Method = "GET", 
    ResponseFormat = WebMessageFormat.Json, 
    BodyStyle = WebMessageBodyStyle.Wrapped, 
    UriTemplate = "AlmacenaPedido/{telefono}/{fechaPedido}/{horaPedido}/{codigoInterno}/{descripcionProducto}/{cantidadProducto}/{valorUnitario}/{kilosProducto}/{fechaEntrega}/{horaEntrega}/{fechaDespacho}/{horaDespacho}")] 
int AlmacenaPedido(string telefono, string fechaPedido, string horaPedido, string codigoInterno, string descripcionProducto, 
        string cantidadProducto, string valorUnitario, string kilosProducto, string fechaEntrega, string horaEntrega, 
        string fechaDespacho, string horaDespacho); 

EDIT:これは、これは、IISの制限である完全なweb.configファイル

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
     <section name="WS_PedidoCliente.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </sectionGroup> 
    </configSections> 
    <appSettings> 
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> 
    </appSettings> 
    <system.web> 
    <compilation debug="true" targetFramework="4.5" /> 
    <httpRuntime targetFramework="4.5" relaxedUrlToFileSystemMapping="true" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
    <service name="WS_PedidoCliente.SvcLipigas" behaviorConfiguration="serviceBehavior"> 
     <endpoint address="" 
       binding="webHttpBinding" 
       contract="WS_PedidoCliente.ISvcLipigas" 
       bindingNamespace="http://ws.lipigas.cl" 
       behaviorConfiguration="web"></endpoint> 
      </service> 
    </services>  
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="serviceBehavior"> 
      <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
      <serviceMetadata httpGetEnabled="true" /> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     </serviceBehaviors> 
     <endpointBehaviors> 
     <behavior name="web"> 
      <webHttp /> 
     </behavior> 
     </endpointBehaviors>  
    </behaviors> 
    <protocolMapping> 
     <add scheme="http" binding="webHttpBinding"/> 
    </protocolMapping> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
    <!-- 
     To browse web app root directory during debugging, set the value below to true. 
     Set to false before deployment to avoid disclosing web app folder information. 
     --> 
    <directoryBrowse enabled="true" /> 
    </system.webServer> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
     <parameters> 
     <parameter value="v12.0" /> 
     </parameters> 
    </defaultConnectionFactory> 
    </entityFramework> 
    <connectionStrings> 
    <add name="LipigasEntities" connectionString="metadata=res://*/Model.Lipigas.csdl|res://*/Model.Lipigas.ssdl|res://*/Model.Lipigas.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE=SLLCOSTO;PASSWORD=uni_1915sll;USER ID=PEDIDO&quot;" providerName="System.Data.EntityClient" /> 
    </connectionStrings> 
    <applicationSettings> 
    <WS_PedidoCliente.Properties.Settings> 
     <setting name="Usuario" serializeAs="String"> 
     <value>EMDITEC</value> 
     </setting> 
    </WS_PedidoCliente.Properties.Settings> 
    </applicationSettings> 
</configuration> 
+0

<httpRuntime relaxedUrlToFileSystemMapping="true" /> 

を追加してみてください? – Alex

+0

WCFしかし、私はこれが超過だと思う、操作が呼び出されていないので、URLのドット – jstuardo

+1

のために、それはまったく大嫌いではない。あなたのメソッドに 'WebGet'属性で注釈を付け、uriテンプレートを提供しましたか?あなたはこれのいくつかのコードを投稿できますか? – Alex

答えて

1

あります。
ドット(エンコードされているかどうか)を拡張子として扱います。

あなたが使用しているサーバーサイド技術のweb.config

+0

私は恐れますが、うまくいきませんでした。質問の本文に完全なweb.configファイルを追加しました。 – jstuardo

+0

あなたはIIS Express、またはcassiniを使用していますか? – Alex

+0

まだ開発中ですので、ASP.NET開発サーバーです。 – jstuardo

関連する問題