swaggerwcf icon indicating copy to clipboard operation
swaggerwcf copied to clipboard

api-docs is not generated

Open mustafatig opened this issue 6 years ago • 6 comments

i have configured as doc but it is not working. What is my wrong? Could you please help me? i did not fix it. You can access ticket from here.

mustafatig avatar Jan 31 '19 05:01 mustafatig

check Step 5 and Step 6 then visit http://localhost/RegistrationService/api-docs/swagger.json if you get json string, go to visit http://localhost/RegistrationService/api-docs/index.html

justin0522 avatar Feb 02 '19 05:02 justin0522

i checked. everything is the same with doc. when i visit, it redirects me this url. http://localhost/DummyProject/api-docs/index.html?url=/DummyProject/api-docs/swagger.json

protected void Application_Start(object sender, EventArgs e) { RouteTable.Routes.Add(new ServiceRoute("api-docs", new WebServiceHostFactory(), typeof(SwaggerWcfEndpoint))); }

Web Config is <configuration> <configSections> <section name="swaggerwcf" type="SwaggerWcf.Configuration.SwaggerWcfSection, SwaggerWcf" /> </configSections> <swaggerwcf> <tags> <tag name="LowPerformance" visible="false" /> </tags> <settings> <setting name="InfoDescription" value="Sample Service to test SwaggerWCF" /> <setting name="InfoVersion" value="0.0.1" /> <setting name="InfoTermsOfService" value="Terms of Service" /> <setting name="InfoTitle" value="SampleService" /> <setting name="InfoContactName" value="Abel Silva" /> <setting name="InfoContactUrl" value="http://github.com/abelsilva" /> <setting name="InfoContactEmail" value="[email protected]" /> <setting name="InfoLicenseUrl" value="https://github.com/abelsilva/SwaggerWCF/blob/master/LICENSE" /> <setting name="InfoLicenseName" value="Apache License" /> </settings> </swaggerwcf> <system.webServer> <directoryBrowse enabled="true"/> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> <system.web> <compilation debug="true" targetFramework="4.6.1"/> <httpRuntime targetFramework="4.6.1"/> </system.web> <system.serviceModel> <services> <service name="SwaggerWcf.SwaggerWcfEndpoint"> <endpoint address="" binding="webHttpBinding" contract="SwaggerWcf.ISwaggerWcfEndpoint"></endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior name=""> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel> </configuration>

Interface:

` [ServiceContract] public interface IDummyService {

    [SwaggerWcfPath("Get Dummy", "Retrieve all dummy from the store")]
    [WebInvoke(UriTemplate = "/getdata",
    BodyStyle = WebMessageBodyStyle.Bare,
    Method = "POST",
    RequestFormat = WebMessageFormat.Json,
    ResponseFormat = WebMessageFormat.Json)]
    [OperationContract]
    void GetData();
}`

Service: [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [SwaggerWcf("/v1/rest")] public class DummyService : IDummyService { [SwaggerWcfTag("GetData")] [SwaggerWcfResponse(HttpStatusCode.Created, "Data created, value in the response body with id updated")] [SwaggerWcfResponse(HttpStatusCode.BadRequest, "Bad request", true)] [SwaggerWcfResponse(HttpStatusCode.InternalServerError, "Internal error (can be forced using ERROR_500 as book title)", true)] public void GetData() { } }

mustafatig avatar Feb 04 '19 06:02 mustafatig

i create a project with your code, https://github.com/justin0522/swaggerwcf190 it works for me

justin0522 avatar Feb 13 '19 09:02 justin0522

It is not same as my code. Could you please fix on this project? https://github.com/mustafatig/SwaggerWCFSample

mustafatig avatar Feb 15 '19 11:02 mustafatig

i created a pull request to your project

justin0522 avatar Feb 18 '19 13:02 justin0522

i create a project with your code, https://github.com/justin0522/swaggerwcf190 it works for me

Hi I'm getting 400 Bad Request in fiddler when I navigate to the api-docs URL on my project

gethari avatar Mar 09 '21 04:03 gethari